I'm trying to translate my site into different languages, thanks to Yii::t()
I have translated all texts. But I'm using pretty urls and it should translate them for better user experience.
I'm using the component. translate-manager
by lajax to make translations
I have tried to add Yii::t()
keys of the rules, I can translate them, but when you change language ignores translation and Yii use the original rule.
This is my urlManager:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'rules' => [
['pattern' => '<id:rss>', 'route' => 'rss/default/index', 'suffix' => '.xml'],
['pattern' => '<id:rss>', 'route' => 'rss/default/index'],
['pattern' => 'sitemap', 'route' => 'sitemap', 'suffix' => '.xml'],
'/' => 'site/index',
Yii::t('config main', '<site:(about|contact|login|logout|signup|policy|conditions|blog)>') => 'site/<site>',
Yii::t('config main', '<device:\w+>/compare-price') => 'items/compareprices',
Yii::t('config main', 'versus/<brand1:\w+>-<model1:[\w\-]+>-<brand2:\w+>-<model2:[\w\-]+>') => 'items/versus',
Yii::t('config main', 'versus/<brand1:\w+>-<model1:[\w\-]+>-<brand2:\w+>-<model2:[\w\-]+>-<brand3:\w+>-<model3:[\w\-]+>') => 'items/versus',
Yii::t('config main', 'versus/<brand1:\w+>-<model1:[\w\-]+>-<brand2:\w+>-<model2:[\w\-]+>-<brand3:\w+>-<model3:[\w\-]+>-<brand4:\w+>-<model4:[\w\-]+>') => 'items/versus',
Yii::t('config main', '<device: \w+>/advanced-search') => 'items/advancedsearch',
],
],
Exemple:
domain.com/conditions
will be domain.com/condiciones
in spanish
How do I have to implement internationalization in the urls?