Hi,
[size="5"]a )[/size]
I try to use translation in urlManager rules but it doesn’t work. Here is the code from config file main.php.
'urlManager'=>array(
'urlFormat'=>'path',
'useStrictParsing' => true,
'showScriptName' => false,
'rules'=>array(
Yii::t('glob','new-user') => 'user/create',
),
),
After switching language from "en" to the other language there is no change in url.
I just wanted to avoid to write "redundant" rows of code for the same action in different languages - like this
'urlManager'=>array(
'urlFormat'=>'path',
'useStrictParsing' => true,
'showScriptName' => false,
'rules'=>array(
'new-user' => 'user/create',
'neue-benutzer' => 'user/create',
'nouvel-utilisateur' => 'user/create',
),
),
[size="5"]b )[/size]
When I have the following rules. It’s obvious which language is selected based on the strings (new-user, neue-benutzer,…).
'urlManager'=>array(
'urlFormat'=>'path',
'useStrictParsing' => true,
'showScriptName' => false,
'rules'=>array(
'new-user' => 'user/create',
'neue-benutzer' => 'user/create',
'nouvel-utilisateur' => 'user/create',
),
),
Therefore I would like to set for example $_GET[‘lang’] for every language pattern separately (to avoid the next handling in Controller). My imagination is like this:
'urlManager'=>array(
'urlFormat'=>'path',
'useStrictParsing' => true,
'showScriptName' => false,
'rules'=>array(
'new-user' => array('user/create', 'lang'=>'en'),
'neue-benutzer' => array('user/create', 'lang'=>'de'),
'nouvel-utilisateur' => array('user/create', 'lang'=>'fr'),
),
),