Multilanguage site with seo urls

Hi,

I’m building a multilanguage website, where users can choose the language they prefer. I have extended CUrlManager and have build a widget for a form for language selection. Everything works fine, except in the url creation.

I need too have two different urls(patterns) for the same route, so in my config/main.php I have the following rules:


...

'rules'=>array(

                '<lang:\w{2}>/contact' => 'site/contact',

'<lang:\w{2}>/contato' => 'site/contact',

	'<lang:\w{2}>/<controller:\w+>/<action>'=>'<controller>/<action>',

			),

...

and I’m trying to use these urls:

www.mysite.com/en/contact

www.mysite.com/pt/contato

and both should go for the following site/contact, but when creating urls when it finds the first that matches it will stop looking in rules, and so I always get the first, even if I change language.

How can I achieve this?

Thanks in advance

I personally followed this wiki and it proved very useful: http://www.yiiframework.com/wiki/294/seo-conform-multilingual-urls-language-selector-widget-i18n/

I’ve seen that already but the only part of the url that changes is the language, the rest doesn’t change, and that is my problem, but thanks for your help.

you can do this:


...

'matchValue'=>true,

'rules'=>array(

        '<lang:en>/contact' => 'site/contact',

        '<lang:pt>/contato' => 'site/contact',

        '<lang:\w{2}>/<controller:\w+>/<action>'=>'<controller>/<action>',

),

...

It was exactly this that i was searching for.

Thank you for your help.