Yii v2 snippet guide

Comparing #67 with #68

Revision #68 was created by rackycz rackycz on Sep 20, 2019, 2:30:08 PM.

edit

Content

[...]
Now you can open the page for adding a new user and you will see than so far nothing changed :-)

- [http://localhost/basic-/web/index.php?r=user%2Fcreate](http://localhost/basic-/web/index.php?r=user%2Fcreate)

We must change the language ... For now let's do it in a primitive
way. Open the userController, find actionCreate() and paste this code:
 
 
```php
 
Yii::$app->language = "cs-CZ"; // use your language
and permanent way again in file config/web.php
 
 
```php
 
$config = [
 
    // use your language
 
    // also accessible via Yii::$app->language
 
    'language' => 'cs-CZ',
 
    
 
    'sourceLanguage' => 'en-US', // en-US is default value, try not to change it.

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