承接 harlangray/languageswitcher 相关项目开发

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

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

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
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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