Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 827 Bytes

README.md

File metadata and controls

44 lines (33 loc) · 827 Bytes

yii2-language-selector

Component for Yii2 language selector

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist makroxyz/yii2-language-selector "*"

or add

"makroxyz/yii2-language-selector": "*"

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' => 'makroxyz\language\Language',
        // ...
    ],
    ...
];

then you can call

Yii::$app->lang->getMenuItems()

to obtain language dropdown items for use in your yii\widgets\Menu or yii\bootstrap\Nav