xtomdex / yii2-widget-language
Rendering dropdown list with languages to switch
Package info
github.com/xtomdex/yii2-widget-language
Type:yii2-extension
pkg:composer/xtomdex/yii2-widget-language
1.0.4
2019-11-27 06:57 UTC
Requires
- xtomdex/country-flags: *
- yiisoft/yii2: >=2.0.0
README
Renders languages dropdown for choosing application language. Excepts current application language from the list and puts it in the dropdown link
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist xtomdex/yii2-widget-language "*"
or add
"xtomdex/yii2-widget-language": "*"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply use it in your code by :
<?= \xtomdex\widgets\Language::widget([ 'items' => [ 'en' => [ 'name' => 'English', 'countryCode' => 'gb' //country code ], 'ru' => [ 'name' => 'Русский', 'countryCode' => 'ru' ], ] //default items, pass all languages that are used in your app ]); ?>