PHPackages                             sentence/i18n-routing-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. sentence/i18n-routing-bundle

ActiveSymfony-bundle[Localization &amp; i18n](/categories/localization)

sentence/i18n-routing-bundle
============================

Full routing internationalized on your Symfony2 project

v2.4.2(7y ago)044MITPHPPHP &gt;=5.3.2

Since Dec 20Pushed 7y agoCompare

[ Source](https://github.com/Sentence/BeSimpleI18nRoutingBundle)[ Packagist](https://packagist.org/packages/sentence/i18n-routing-bundle)[ Docs](https://github.com/Sentence/BeSimpleI18nRoutingBundle)[ RSS](/packages/sentence-i18n-routing-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (9)Versions (13)Used By (0)

I18nRoutingBundle, generate your I18N Routes for Symfony2
=========================================================

[](#i18nroutingbundle-generate-your-i18n-routes-for-symfony2)

If you have a website multilingual, this bundle avoids of copy paste your routes for different languages. Additionally it allows to translate given routing parameters between languages in Router#match and UrlGenerator#generate using either a Symfony Translator or a Doctrine DBAL (+Cache) based backend.

[![Latest Version on Packagist](https://camo.githubusercontent.com/a0700e031691dea1c14fcc6ff255d054cacce8f639a3343ce3d46e1913ce8b6a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f426553696d706c652f6931386e2d726f7574696e672d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/BeSimple/i18n-routing-bundle)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](src/Resources/meta/LICENSE)[![Build Status](https://camo.githubusercontent.com/f9517b4ebf000f634fea768f1a0fd224c359ca185143a2488f0fbf61201610d2/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f426553696d706c652f426553696d706c654931386e526f7574696e6742756e646c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/BeSimple/BeSimpleI18nRoutingBundle)[![Total Downloads](https://camo.githubusercontent.com/674a54e15d1555f6ac279211210911d640ddd357f358e9c8e270610d2e99f5d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f426553696d706c652f6931386e2d726f7574696e672d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/BeSimple/i18n-routing-bundle)

Information
-----------

[](#information)

When you create an I18N route and you go on it with your browser, the locale will be updated.

Installation
------------

[](#installation)

```
composer.phar require besimple/i18n-routing-bundle
```

```
//app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        //...
        new BeSimple\I18nRoutingBundle\BeSimpleI18nRoutingBundle(),
    );
}
```

### Update your configuration

[](#update-your-configuration)

```
# app/config/config.yml
be_simple_i18n_routing: ~
```

Create your routing
-------------------

[](#create-your-routing)

To define internationalized routes in XML or YAML, you need to import the routing file by using the `be_simple_i18n` type:

```
my_yaml_i18n_routes:
    resource: "@MyWebsiteBundle/Resources/config/routing/i18n.yml"
    type: be_simple_i18n
    prefix:
        en: /website
        fr: /site
        de: /webseite
my_xml_i18n_routes:
    resource: "@MyWebsiteBundle/Resources/config/routing/i18n.xml"
    type: be_simple_i18n
```

You can optionally specify a prefix or translated prefixes as shown above.

### Yaml routing file

[](#yaml-routing-file)

```
homepage:
    locales:  { en: "/welcome", fr: "/bienvenue", de: "/willkommen" }
    defaults: { _controller: MyWebsiteBundle:Frontend:index }
```

### XML routing file

[](#xml-routing-file)

```

        /welcome
        /bienvenue
        /willkommen
        MyWebsiteBundle:Frontend:index

```

Note that the XML file uses a different namespace than when using the core loader: `http://besim.pl/schema/i18n_routing`.

### PHP routing file

[](#php-routing-file)

```
