Difference between #28 and #29 of
Yii v2 snippet guide III

Revision #29 has been created by rackycz on Feb 12, 2021, 9:15:35 AM with the memo:

test
« previous (#28) next (#30) »

Changes

Title unchanged

Yii v2 snippet guide III

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,yii2,beginer

Content changed

** My articles** ---
Articles are separated into more files as there is the max lenght for each file on wiki.
[...]
** Switching languages and Language in URL** ---

I already [wrote](https://www.yiiframework.com/wiki/2552/yii-v2-snippet-guide#i18n-translations) how translations work. Here I will show how language can be switched and saved into the URL.
[...]
Now the language-switching links will produce URL like this: http://myweb.com/en/site/index . Without the rules the link would look like this: http://myweb.com/site/index?sys_lang=en . So the rule works in both directions. When URL is parsed and controllers are called, but also when a new URL is created using the URL helper.

**
 Search and replace Yii::t()** ---
Simple usage in format Yii::t('text','text') can be searched using following regex for example in Notepad++. If you want to modify it massively, you can use the "replace" command, also in Notepad++.

```
search: Yii::t\('([^']*)'[^']*'([^']*)'[^\)]*\)
replace with: Yii::t\('$1','$2'\)
[...]
8 0
4 followers
Viewed: 191 143 times
Version: 2.0
Category: Tutorials
Written by: rackycz
Last updated by: rackycz
Created on: Jan 21, 2021
Last updated: a year ago
Update Article

Revisions

View all history