Yii v2 snippet guide

Comparing #69 with #70

Revision #70 was created by rackycz rackycz on Sep 20, 2019, 2:35:29 PM.

edit

Content

[...]
// 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 ...