janatjak
janatjak

Reputation: 63

Symfony router - one route name for more paths based on host+locale

is possible create symfony route with one name (e.g. "contact") and more paths based on host? And this route sets _locale by host too.

I need it for simple usage {{ path('contact') }} in template.

Example:

contact:
     host:      example.com
     path:      /contact
     defaults:  { _controller: AppBundle:Contact:index, _locale: en }

     host:      example.cz
     path:      /kontakt
     defaults:  { _controller: AppBundle:Contact:index, _locale: cs }

Thanks.

Upvotes: 2

Views: 84

Answers (1)

panche14
panche14

Reputation: 661

You can use JMSI18nRoutingBundle for this. In this page you can find the same case.

Upvotes: 2

Related Questions