Multilanguage URL

Is there a way to make the URLs for the same action/controller change in diferent languages different?

For example:

http://www.mydomain.com/index.php/MyModule/MyController/MyAction

to:

http://www.mydomain.com/index.php/[language]/MyModule/MyController/MyAction


I was working on this direction when I had to implement multilanguage interface… It appears that there is no easy way to do this without rewriteing (most of) CUrlManager. Finally I did it adding extra get parameter with the locale id for every link and attached a behaviour in the application to change the language according to this GET parameter… It is something simmilar to the approach in the Yii cookbook: http://www.yiiframew…oc/cookbook/26/

You may extend CUrlManager and override its createUrl() method. At the beginning of the method, you can set $params['language']=Yii::app()->language.

Then add a URL rule as follows (requiring 1.0.5):



'<language:(en|es...)>/<route:[w\/]+>' => '<route>',


Thanks !!!

This framework is awesome!! :D

Hey, i try this and it doesn't work how i want, maybe (or surely) is my mistake,

in main.php config file:

the MyCurl class:

the error is this:

Page Not Found

Unable to resolve the request "en/company/index".

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Where is my mistake?

My Mistake on the route,

(en|es…) must be (en|es).

Sorry for that  :-[

thanx for this thing

defore this i have rules like this:

'users/<usertype:d+>'=>'user/list',

how do i need to change my rules after setup this one (language)?