Ville Mattila
Ville Mattila

Reputation: 1343

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?

Upvotes: 6

Views: 1773

Answers (1)

Carlos Granados
Carlos Granados

Reputation: 11351

Specify the option in the annotations. Something like:

/**
 * @Route("/", options={"i18n" = false})
 */

Upvotes: 6

Related Questions