Versions

Table Of Contents

Support

You can obtain free community support for example through stackoverflow, or also through the Symfony2 mailing list.

If you think you found a bug, please create a ticket in the bug tracker.


Continuous Inspections

If you take code quality seriously, try out the new continuous inspection service.
scrutinizer-ci.com

GitHub

Usage

Introduction

You can continue to create routes like you would do normally. In fact, during development you don?t need to make any special changes to your existing routes to make them translatable.

Translating Routes

Once your code is stable enough to begin translation, you can use the translation:extract command that is provided by JMSTranslationBundle:

$ php app/console translation:extract de --enable-extractor=jms_i18n_routing # ...

Please refer to the bundle?s documentation for more information.

Generating Routes

By default, the router uses the following algorithm to determine which locale to use for route generation:

  1. use the _locale parameter which was passed to the generate() method
  2. use the _locale parameter which is present in the request context
  3. use the configured default locale

Some examples below:

<!-- uses locale of the request context to generate the route -->
<a href="{{ path("contact") }}">Contact</a>

<!-- sometimes it's necessary to generate routes for a locale other than that
     of the request context, then you can pass it explicitly -->
<a href="{{ path("homepage", {"_locale": "de"}) }}">Deutsch</a>
<a href="{{ path("homepage", {"_locale": "en"}) }}">English</a>

Leaving routes untranslated

If you don?t want to translate a single given route, you can disable it:

# app/config/routing.yml
homepage:
    ...
    options: { i18n: false }