I am a newbie to Yii and am in the process of developing a multilingual (English and French) website.
I tried what was suggested in the first post here:
[post='http://www.yiiframework.com/forum/index.php?/topic/6137-example-of-changing-language/ ']http://www.yiiframework.com/forum/index.php?/topic/6137-example-of-changing-language/ [/post]
It works exactly as intended (the French text is echoed) as long as I use
echo Yii::t('blog','Active record class "{class}" does not have a scope named "{scope}".');
in protected/views/layout/main.php. However, if I use the same line of code in a view, I get the English code instead. Furthermore, in the view, if I do
echo Yii::app()->getLanguage();
I get ‘en_us’.
Shouldn’t using
Yii::app()->setLanguage($lang);
in protected/views/layout/main.php affect the language in the view?
Thanks in advance for your help.
Note: I understand that if I want the user’s language to apply to there entire session I will need to store it in a session. For the moment, though, I am only trying to deal with one page load.