定制 zolotarev/yii2-i18n-module 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

zolotarev/yii2-i18n-module

最新稳定版本:0.1.9

Composer 安装命令:

composer require zolotarev/yii2-i18n-module

包简介

EXTENDED Yii2 i18n (internalization) module makes the translation of your application so simple

README 文档

README

Yii2 i18n (internalization) module makes the translation of your application so simple

Installation

Composer

The preferred way to install this extension is through Composer.

Either run

php composer.phar require zelenin/yii2-i18n-module "dev-master"

or add

"zelenin/yii2-i18n-module": "dev-master"

to the require section of your composer.json

Usage

Configure I18N component in common config:

'i18n' => [
	'class' => Zelenin\yii\modules\I18n\components\I18N::className(),
	'languages' => ['ru-RU', 'de-DE', 'it-IT']
],

Configure I18N component in backend config:

'modules' => [
	'i18n' => Zelenin\yii\modules\I18n\Module::className()
],

Run:

php yii migrate --migrationPath=@Zelenin/yii/modules/I18n/migrations

Go to http://backend.yourdomain.com/translations for translating your messages

PHP to DB import

If you have an old project with PHP-based i18n you may migrate to DbSource via console.

Run:

php yii i18n/import @common/messages

where @common/messages is path for app translations

DB to PHP export

Run:

php yii i18n/export @Zelenin/yii/modules/I18n/messages zelenin/modules/i18n

where @Zelenin/yii/modules/I18n/messages is path for app translations and zelenin/modules/i18n is translations category in DB

Using yii category with DB

Import translations from PHP files

php yii i18n/import @yii/messages

Configure I18N component:

'i18n' => [
    'class'=> Zelenin\yii\modules\I18n\components\I18N::className(),
    'languages' => ['ru-RU', 'de-DE', 'it-IT'],
    'translations' => [
        'yii' => [
            'class' => yii\i18n\DbMessageSource::className()
        ]
    ]
],

Info

Component uses yii\i18n\MissingTranslationEvent for auto-add of missing translations to database

See Yii2 i18n guide

Author

Aleksandr Zelenin, e-mail: aleksandr@zelenin.me

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 40
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-07-01