wearesho-team/yii2-header-language-selector

Library for configuring auto setting language from headers in yii2 application

1.0.0 2018-10-08 10:34 UTC

This package is auto-updated.

Last update: 2024-11-26 05:46:58 UTC


README

Build Status codecov

This library allows you to configure setting language from http header in yii2 application.

Setup

composer require wearesho-team/yii2-header-language-selector

Configure

Append bootstrap declaration in your app config with next item

<?php

// config/main.php

use Wearesho\Yii\HeaderLanguageSelector;

return [
    'id' => 'appId',
    'basePath' => __DIR__,
    'bootstrap' => [
        'headerLanguageSelector' => [
            'class' => HeaderLanguageSelector\Bootstrap::class,
            'defaultLanguage' => 'ru',
            'supportedLanguages' => ['ua', 'ru', 'en',],
            'headerAttribute' => 'language',
        ],
    ],
];