Yii I18n topic is not enough for me.
My source language is Turkish, the target language is English (for example)
Action of my test controller:
public function actionIndex() { Yii::app()->language='en'; $this->render("index"); }
This is my view file contents:
echo Yii::t('test', 'Deneme');
And finally, this is my protected / message file / en / test.php:
return array( 'Deneme' => 'Example', );
Everything is in order, it returns an Example . But, as you can see, I set the language manually in my indexed action . How can I do this automatically? Should I add Yii :: app () → language = 'en'; to all actions? How do you use l18n in your projects?
Note: I am Yii and l18n noob, so please describe step by step.
Thanks.
source share