定制 pvlg/yii2-language-switcher 二次开发

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

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

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-28