Revision #139 has been created by rackycz on Oct 4, 2019, 4:34:54 PM with the memo:
edit
« previous (#138) next (#140) »
Changes
Title
unchanged
Yii v2 snippet guide
Category
unchanged
Tutorials
Yii version
unchanged
2.0
Tags
unchanged
tutorial,beginner,yii2
Content
changed
[...]
If you have a view with long texts and you want to translate it into a 2nd language, it is not good idea to use the previous approach, because it uses the English text as the ID.
It is better to translate the whole view. How? ... Just create a sub-folder next to the view and give it name which will be identical to the target-lang-ID. In my case the 2nd language is Czech so I created following folder and copied my view in it. So now I have 2 identical views with identical names:
- "C:\xampp\htdocs\chatarbasic\views\site\about.php" ... English
- "C:\xampp\htdocs\
chatarbasic\views\site\cs-CZ\about.php" ... Czech
Yii will automatically use the Czech version if needed.
**Switching languages + session + lang-dropdown in the top menu**
---[...]