jenyak/i18n-routing-service-provider
最新稳定版本:v1.0
Composer 安装命令:
composer require jenyak/i18n-routing-service-provider
包简介
Silex i18n routing service provider.
关键字:
README 文档
README
Silex i18n routing service provider inspired by JMSI18nRoutingBundle
Installation
Recommended installation is through composer. Just add
the following to your composer.json file:
Silex 1.3
{
"require": {
"jenyak/i18n-routing-service-provider": "~1.0"
}
}
Silex 2
{
"require": {
"jenyak/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', 'hu', 'ua'); // You can translate patterns $app['translator.domains'] = array('routes' => array( 'hu' => array('test_route' => '/teszt'), )); // There's no need to put {_locale} in route pattern $app->get('/test', function () { //... })->bind('test_route');
Matched URLs will be:
/test - url for default locale without prefix
/hu/teszt - url with prefix and translated
/ua/test - url with prefix
统计信息
- 总下载量: 3.51k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-07