Skip to content

skeeks-semenov/yii2-multi-language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Component for multilingual site

SkeekS blog

Latest Stable Version Total Downloads

Installation

$ composer require skeeks/yii2-multi-language "^1.0.0"

Or add this to your composer.json file:

{
    "require": {
        "skeeks/yii2-multi-language": "^1.0.0"
    }
}

Use config your application

"bootstrap" => ["multiLanguage"],

"language" => "ru", //Your current application language

"components" => [

    "request" => [
        "class" => \skeeks\yii2\multiLanguage\MultiLangRequest::class
    ],
    
    "urlManager" => [
        "class" => \skeeks\yii2\multiLanguage\MultiLangUrlManager::class,
        'enablePrettyUrl' => true,
        'showScriptName' => false,
    ],
    
    "multiLanguage" => [
        "class" => \skeeks\yii2\multiLanguage\MultiLangComponent::class,
        'langs' => ['ru', 'en'],
        'default_lang' => 'ru',         //Language to which no language settings are added.
        'lang_param_name' => 'lang',
    ]
    
]

Example

Url::to(['/module/controller/action', 'id' => 20, 'lang' => 'en'])
// /en/module/controller/action?id=20

Screenshot

SkeekS blog

SkeekS blog

Video

Video

Links


skeeks!
SkeekS CMS (Yii2) — quickly, easily and effectively!
skeeks.com | cms.skeeks.com