harlangray/languageswitcher
最新稳定版本:1.0.0
Composer 安装命令:
composer require harlangray/languageswitcher
包简介
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 "harlangray/languageswitcher": "*"
or add
"harlangray/languageswitcher": "*"
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' => 'harlangray\language\Language', 'queryParam' => 'lang', ], // ... ], ... ];
You must define available languages in Yii::$app->params['languages'] as code => language in the config/params.php
'languages' => [ 'en' => 'english', 'si' => 'සිංහල', 'ta' => 'தமிழ்' ]
and use
Yii::$app->lang->getMenuItems()
In your menu "items"
EX:
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => [
['label' => 'Home', 'url' => ['/site/index']],
........
.........
........
Yii::$app->lang->getMenuItems()
],
]);
NavBar::end();
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-22