Symfony2 translate URL and Routing
Asked Answered
S

1

10

I'm trying to translate my url routing in Symfony2.

I already manage that the tld change the language of my application.

Ex:

  • domain.com => local="en_US"
  • domain.fr => local="fr_FR"
  • domain.it => local="it_IT"

The translation is working for static word in template with {% trans %}Hello %name%{% endtrans %} http://symfony.com/doc/2.0/book/translation.html#translations-in-templates

but I'm trying to translate the routing.

Ex:

  • domain.com/user => FrontBundle:Default:user
  • domain.fr/utilisateur => FrontBundle:Default:user
  • ...

All url going to the same action

I didn't find a good way to do it with Symfony2

ps: I saw this post Zend translate URL and language switcher it's quite the same problem but with Zend

Shandrashandrydan answered 30/1, 2012 at 17:2 Comment(0)
P
6

I think what you are looking for is the BeSimpleI18nRoutingBundle:

https://github.com/BeSimple/BeSimpleI18nRoutingBundle

Pivot answered 30/1, 2012 at 21:12 Comment(2)
This Bundle seem to be made for me but I can't find the doc to see which locale is use for the translation. I use Symfony 2.1.0-DEV and there is no locale in this class. the locale is in the Request. But the Bundle dont see the change and use the translate fallbackShandrashandrydan
Doesn't seem to maintained anymore.Damon

© 2022 - 2024 — McMap. All rights reserved.