sebas
(Sebathi)
May 11, 2009, 3:30pm
1
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
Sentinel
(Cpavlov)
May 11, 2009, 4:07pm
2
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/
qiang
(Qiang Xue)
May 11, 2009, 5:59pm
3
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>',
sebas
(Sebathi)
May 12, 2009, 2:04pm
4
Thanks !!!
This framework is awesome!!
sebas
(Sebathi)
May 27, 2009, 6:11pm
5
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?
sebas
(Sebathi)
May 27, 2009, 6:13pm
6
My Mistake on the route,
(en|es…) must be (en|es).
Sorry for that
romanoza
(Romanoza)
June 18, 2009, 1:02pm
7
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)?