PHP code example of paragraph1 / i18n-routing-service-provider
1. Go to this page and download the library: Download paragraph1/i18n-routing-service-provider library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
paragraph1 / i18n-routing-service-provider example snippets
$app->register(new Jenyak\I18nRouting\Provider\I18nRoutingServiceProvider());
$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');
$app->get('/dont-translate', function() {
//...
})->bind('my_route')->getRoute()->setOption('i18n', false);
# Careful when using Silex\Provider\TranslationServiceProvider