How to add a new language file and how to load it

I created my en_us folder inside messages and also added a index.php file. My question is, how to go from here so I can have the data available under Yii::t for example? I should probably load the file somewhere and make it available through the application.

I’m guessing English (US) will be your default/local language. If that’s the case you do not need to add a translation file in messages for it. say for example you want to add zh_cn(mandarin). you could create messages/zh_cn

next decide on translation categories (yii is reserved for yii core). example say your category is titles, you would create the file messages/zh_cn/titles.php

in that file you will return an array of translations like




return array

(

  'Hello World'=>'世界您好',

  'Hello {user}'=>'喂{user}',

);



and in your controllers or views, to translate your titles to chinese you would use something like this




Yii::t('titles','Hello World');


Yii::t('titles','Hello {user}',array('{user}'=>$user));



hope this helps

It surely clears everything out. This should be in the docs. Thank you so much. I’m still in the dark with many things but it’s going better.

lol, it’s actually in the docs. http://www.yiiframework.com/doc/guide/topics.i18n