pvlg / yii2-language-switcher
Yii Framework 2.0 Component language switcher
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 165
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 2
Open Issues: 2
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2019-05-05 21:29:35 UTC
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