-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi mauricio,

the _locale is automatically taken from the session, no need to
configure anything there. you can just to path('homepage') if you want
the path to the homepage in the current session language.

cheers,david

Am 31.05.2011 14:48, schrieb Mauricio Morales:
> 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
> 

- -- 
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3k9GcACgkQqBnXnqWBgIvEEwCdE45NOCw2DY+K0nNr25pFMDcn
Tj0Anj1IyKby8X6Xj9qctymU/GUNqcJR
=lwal
-----END PGP SIGNATURE-----

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