I have a problem with routing and the internationalization of my site built with Symfony2.
If I define routes in the routing.yml file, like this:
exampl
You can define multiple patterns like this:
example_default:
pattern: /example
defaults: { _controller: ExampleBundle:Example:index, _locale: fr }
example:
pattern: /{_locale}/example
defaults: { _controller: ExampleBundle:Example:index}
requirements:
_locale: fr|en
You should be able to achieve the same sort of thing with annotations:
/**
* @Route("/example", defaults={"_locale"="fr"})
* @Route("/{_locale}/example", requirements={"_locale" = "fr|en"})
*/
Hope that helps!