Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable internationalization for all bundle's all routes when using JMSI18nRoutingBundle?

I use Symfony2's JMSI18nRoutingBundle to allow automatic internationalization of my routes. Individual route internationalization can be disabled in routing.yml as follows

index:
  pattern: /
  defaults: { _controller: AcmeBaseBundle:Welcome:indexRedirector }
  options:
    i18n: false

However, I normally annotate routes in the controllers and define just a prefix in routing.yml:

AcmeApiBundle:
  resource: "@AcmeApiBundle/Controller/"
  type:     annotation
  prefix:   /api
  options:
    i18n: false

In this case, disabling internationalization does not work properly and routes get matched only by adding the locale as a prefix for the URLs.

How to disable the internationalization for the all URLs in the bundle?

like image 758
Ville Mattila Avatar asked Aug 08 '12 13:08

Ville Mattila


1 Answers

Specify the option in the annotations. Something like:

/**
 * @Route("/", options={"i18n" = false})
 */
like image 187
Carlos Granados Avatar answered Sep 22 '22 10:09

Carlos Granados