pvlg/yii2-language-switcher
Composer 安装命令:
composer require pvlg/yii2-language-switcher
包简介
Yii Framework 2.0 Component language switcher
关键字:
README 文档
README
Component for Yii2 language switcher
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist pvlg/yii2-language-switcher "*"
or add
"pvlg/yii2-language-switcher": "*"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply modify your application configuration as follows:
return [ 'bootstrap' => ['lang'], 'components' => [ 'lang' => [ 'class' => 'pvlg\language\Language', //'cookieParams' => [ // 'path' => '/', // 'domain' => '.example.com', // // ... //], 'queryParam' => 'lang', // ... ], // ... ], ... ];
You must define available languages in Yii::$app->params['languages'] as code => language
'languages' => [ 'en' => 'english', 'ru' => 'russian', ]
and use
http://example.com/?lang=russian
统计信息
- 总下载量: 165
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-28