0
votes

I'm currently using JMSI18nRoutingBundle in my Symfony2 project, and it's working fine so far, but I also need the ability to translate the routes itself, for example:

Routes in English

/en/my-route/whatever/XXX

Routes in Spanish

/es/mi-ruta/lo-que-sea/XXX

Summing up, I need the ability to define the following in my controllers:

/**
 * @Route("route.my_route/route.whatever/XXX")
 */

Where route.my_route are messages from the translations files:

messages.en.yml

route:
    my_route: my-route

messages.es.yml

route:
    my_route: mi-ruta

Does anyone knows if this is possible with this bundle at all? If not, is there any other way to achieve the desired effect?

1

1 Answers

0
votes

To self-answer this question, I end up creating my own bundle to handle this special case. Now I can translate routes using a special [] notation, as in:

/**
 * @Route("[route.my_route]/[route.whatever]/XXX")
 */

If you happen to have the very same problem, here is a link to the bundle. Hope you find it useful:

https://github.com/albertofem/TranslatableRoutePathBundle