Hi Chris,

I'm dealing with the same issue at the moment, regarding your routing
issue. This is worth a look:
https://github.com/BeSimple/I18nRoutingBundle

Not going to stop you having to put $_locale in all your controllers,
but seems pretty nice for having a single route for multiple
languages.

Be interested to hear how you get on.

Rob

On Apr 21, 6:40 pm, Christopher N <chro...@gmail.com> wrote:
> I need to get URL's with the locale embedded in them. For example, /
> example/12 for default English and /fr/example/12 and /de/example/12
> for other languages.
>
> I can create routes with {_locale} in them, but generating links seems
> a little clumsy:
>
> welcome:
>   pattern: {_locale}/welcome
>   defaults: { _controller: UserBundle:Main:index, _locale: en }
>
> I can view /welcome or /fr/welcome,
>
> But if I'm on /welcome: {{path('welcome')}} generates /en/welcome
> If I'm on /fr/welcome: {{path('welcome')}} generates /en/welcome still
>
> So I'm looking for ideas on how to:
> 1) Never include the locale part on the default locale
> 2) Set the proper locale parameter in the URLs when using a different
> locale, so I don't have to pass it around everywhere.
>
> This is a site-wide thing, so the locale is really a base path that
> needs to be prepended to *all* links. My first idea was to customize
> the generator to handle _locale specially. But perhaps I write this
> lower down the stack, rather than include locale in the actual defined
> routes?

-- 
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