Bootstrap class to set application language by header attribute., (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist humandevice/yii2-header-language-selector "*"
or add, (*4)
"humandevice/yii2-header-language-selector": "*"
to the require section of your composer.json
file., (*5)
Usage
Once the extension is installed, simply use it in your REST API config:, (*6)
return [
// ...
'bootstrap' => [
// ...
'languageSelector' => [
'class' => 'hd\yii2\bootstrap\LanguageSelector',
'supportedLanguages' => ['en', 'pl'],
'defaultLanguage' => 'pl'
],
],
];