xtomdex / yii2-widget-language
Rendering dropdown list with languages to switch
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
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 ]); ?>