xtomdex/yii2-widget-language

Rendering dropdown list with languages to switch

1.0.4 2019-11-27 06:57 UTC

This package is auto-updated.

Last update: 2024-04-27 17:03:54 UTC


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
]); ?>