2017 © Pedro Peláez
 

library i18n-routing-service-provider

Silex i18n routing service provider. Forked from ehibes/I18nRoutingServiceProvider

image

paragraph1/i18n-routing-service-provider

Silex i18n routing service provider. Forked from ehibes/I18nRoutingServiceProvider

  • Wednesday, August 10, 2016
  • by palbertini
  • Repository
  • 3 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 10 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

I18n Routing Service Provider
Build Status, (*1)

Coverage Status

Silex i18n routing service provider inspired by JMSI18nRoutingBundle, (*2)

Installation

Recommended installation is through composer. Just add the following to your composer.json file:, (*3)

Silex 2

{
    "require": {
        "paragraph1/i18n-routing-service-provider": "dev-master"
    }
}

Registering

$app->register(new Jenyak\I18nRouting\Provider\I18nRoutingServiceProvider());

Parameters

  • i18n_routing.translation_domain: Translation domain for routes. The default value is routes.
  • i18n_routing.locales: Routing locales. The default value is array(en).
  • locale: Default routing locale. The default value is en.

Example

$app = new Application();
//...
$app->register(new Jenyak\I18nRouting\Provider\I18nRoutingServiceProvider());
$app['locale'] = 'en';
$app['i18n_routing.locales'] = array('en', 'eu', 'fr');

// You can translate patterns
$app['translator.domains'] = array('routes' => array(
    'fr' => array('test_route' => '/entsegu-bat'),
));

// There's no need to put {_locale} in route pattern
$app->get('/test', function () {
   //...
})->bind('test_route');

Matched URLs will be:, (*4)

/en/test - url for default locale without prefix, (*5)

/eu/entsegu-bat - url with prefix and translated, (*6)

/fr/test - url with prefix, (*7)

Disable I18n for a route

$app->get('/dont-translate', function() {
    //...
})->bind('my_route')->getRoute()->setOption('i18n', false);

# Careful when using Silex\Provider\TranslationServiceProvider

```php
$app = new Application();
// when also using TranslationServiceProvider add your routes when registering it:
$app->register(new Jenyak\I18nRouting\Provider\I18nRoutingServiceProvider());
...
$app->register(new \Silex\Provider\TranslationServiceProvider(), array(
    'locale_fallbacks' => array('en'),
    'translator.domains' => array(
        'fr' => array('test_route' => '/entsegu-bat')
    )
));

The Versions

10/08 2016

dev-master

9999999-dev

Silex i18n routing service provider. Forked from ehibes/I18nRoutingServiceProvider

  Sources   Download

MIT

The Requires

 

The Development Requires

silex i18n routing

10/08 2016

0.1

0.1.0.0

Silex i18n routing service provider. Forked from ehibes/I18nRoutingServiceProvider

  Sources   Download

MIT

The Requires

 

The Development Requires

silex i18n routing

03/02 2016

1.0.x-dev

1.0.9999999.9999999-dev

Silex i18n routing service provider.

  Sources   Download

MIT

The Requires

 

The Development Requires

silex i18n routing

14/09 2015

v1.0

1.0.0.0

Silex i18n routing service provider.

  Sources   Download

MIT

The Requires

 

The Development Requires

silex i18n routing