Thanks Crhistophe,

So I do this:

homepage:
    pattern:   /{_locale}/
    defaults:  { _controller: WebsiteBundle:Home:index }
    requirements:
        _locale: en|es


But then I have to do this:
<a href="{{ path('homepage', {'_locale':
app.request.attributes.get('_locale')}) }}"></a>


What I'd like to have is a way to automate the passing of the _locale
variable to all the routes. Is there any way?, am I missing something
in the configuration?

THanks.

On May 31, 1:22 pm, Christophe COEVOET <s...@notk.org> wrote:
> Le 31/05/2011 13:14, Mauricio Morales a �crit :
>
>
>
>
>
>
>
> > Hi there community :)
>
> > I'm trying to build a URL routing scheme for a web application that
> > will be offered in different languages. It's a Symfony2 app and I've
> > been wondering what the best way to address this situation is.
>
> > What we need is as simple as this, i.e.:
>
> > example.com/es/services
> > example.com/en/services
>
> > example.com/en/terms-of-use
> > example.com/es/terms-of-use
>
> > Notice that we don't need I18N, we always keep the same URL routes and
> > parameters, and the only part that will change is the prefix (first
> > part of URL). What we are looking for is for a very transparent way to
> > build the URLs and keep the locale in them, a very easy-to-use
> > solution, we don't want to care about the locale in URL generation in
> > templates or controllers.
>
> > Have you addressed a situation like that?, do you have any ideas,
> > thoughts?
>
> > Thanks a lot,
>
> Use a /_locale/ placeholder in the routes. This will set the locale
> automatically when matching the route and the locale will be injected
> when generating an url.
>
> --
> Christophe | Stof

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to