Difference between #69 and #70 of
Yii v2 snippet guide

Revision #70 has been created by rackycz on Sep 20, 2019, 2:35:29 PM with the memo:

edit
« previous (#69) next (#71) »

Changes

Title unchanged

Yii v2 for beginners

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,beginner,yii2

Content changed

[...]
// en-US is default value
'sourceLanguage' => 'en-US',

// ... other configs
```
Note: This language-setting will be forgotten as soon as you click somewhere. In next chapter we will enhance this ..
 
 
Switching languages + session + dropdown in the top menu
 
---
 
... text ...

 
Switching languages + session + dropdown in the top menu
 
---
 
First lets add to file config/web.php one more attribute with list of supported languages:
 
 
```php aa
 
// config/web.php
 
$config = [
 
    // use your language
 
    // also accessible via Yii::$app->language
 
    'language' => 'cs-CZ',
 
    
 
    // This attribute is not necessary.
 
    // en-US is default value
 
    'sourceLanguage' => 'en-US',
 
 
    'allowedLanguages' => ['en-US', 'cs-CZ'],
 
    
 
    // ... other configs
 
```
 
Access rights --- ... text ...
7 0
4 followers
Viewed: 274 953 times
Version: 2.0
Category: Tutorials
Written by: rackycz
Last updated by: rackycz
Created on: Sep 19, 2019
Last updated: a year ago
Update Article

Revisions

View all history