Where can I set language (based on user's cookie) globally? How to make it work in the whole application (controllers,views, etc.) ?
In documentation I found \Yii::$app->language = '';
but, where I can write my logic to change the language in right way?
You can set your base language in the configuration file. In the basic application it's default location is: /config/web.php
, in advanced: application-name/config/main.php
and application-name/config/main-local.php
.
$config = [
'id' => 'basic',
'language' => 'nl', // Set the language here
'basePath' => dirname( __DIR__ ),
'bootstrap' => ['log'],
...
];