anybody has an i18n example to share?

I am working the i18n for a project that I am working on. I still cannot figure out how i18n works for a multilanguage setup. I plan to do sth similar to the Doc here with a slight difference.

Anybody got a tutorial or example on how to set this up?

Thanks,

Hi moho,

Yii provides two types for i18n, database or file. (see http://www.yiiframew…ide/topics.i18n )

As I am using the translation with file I will explain you how to do it.

Add one private variable in the controler as follow :

And in the init method in the SiteController :

So I use en as default and save it in a cookie.

I've created several folders in /protected/messages/

Like /protected/messages/en/ (for english) /protected/messages/fr/ (for french)…

After that Create a file (e.g. :blog.php) wich will contain translations in this directory.

The file (blog.php e.g.) in en directoy will have the following content :

And in /protected/messages/fr directory:

After that just call :

Yii::t('blog','home');

Hope it helps :)

Great. Thanks. Just what I need.

Thanks, this help me a lots… save much of my time…  ;)