承接 paragraph1/i18n-routing-service-provider 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

paragraph1/i18n-routing-service-provider

Composer 安装命令:

composer require paragraph1/i18n-routing-service-provider

包简介

Silex i18n routing service provider. Forked from ehibes/I18nRoutingServiceProvider

README 文档

README

I18n Routing Service Provider
Build Status Coverage Status

Silex i18n routing service provider inspired by JMSI18nRoutingBundle

Installation

Recommended installation is through composer. Just add the following to your composer.json file:

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:

/en/test - url for default locale without prefix

/eu/entsegu-bat - url with prefix and translated

/fr/test - url with prefix

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')
    )
));

统计信息

  • 总下载量: 24
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固