Skip to content

Yii2 bootstrap class to set language by header attribute for REST API

Notifications You must be signed in to change notification settings

HumanDevice/yii2-header-language-selector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Header Language Selector

Bootstrap class to set application language by header attribute.

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

"humandevice/yii2-header-language-selector": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your REST API config:

return [
    // ...
    'bootstrap' => [
        // ...
        'languageSelector' => [
            'class' => 'hd\yii2\bootstrap\LanguageSelector',
            'supportedLanguages' => ['en', 'pl'],
            'defaultLanguage' => 'pl'
        ],
    ],
];

About

Yii2 bootstrap class to set language by header attribute for REST API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages