I18N Bug

Hi,

I want to use i18n in my web application, and it doesn’t work as it should (I guess), here is the code i’m using:


Yii::t('types', 'FUN')

And the result is that it displays ‘FUN’ instead of ‘cool’. I tried to debug, and it look for this file:




C:\ProgramData\wamp\www\CoolApp\protected\messages\fr\zii.php



Why zii.php??? I correctly indicated ‘types’ right?

you can change the file(protected\messages\fr\zii.php) name zii to types (protected\messages\fr\types.php

Check these links:

  1. http://www.yiiframework.com/doc/guide/1.1/en/topics.i18n

  2. http://learnyii.blogspot.in/2010/12/yii-setting-up-internationalization.html

The problem is I don’t have any ziiphp file, I have a types.php and for some reasons it does not work. Did I miss something?

zii.php is framework file, its seems like it didnt load a fr lang at start, do you have any lang picker ?

no, but i think it did load the language at start ‘messages\fr\zii.php’. I configured for fr

How did you set your CApplication::sourceLanguage and CApplication::language ?

Like this, in the main config file php:




return array(

    ...

    'sourceLanguage' => 'fr',

    'language' => 'fr'

);



So there is nothing to translate.

"For a Yii application, we differentiate its target language from source language. The target language is the language (locale) of the users that the application is targeted at, while the source language refers to the language (locale) that the application source files are written in. Internationalization occurs only when the two languages are different."

please read http://www.yiiframework.com/doc/guide/1.1/en/topics.i18n

Thanks a lot, it worked, I changed sourceLanguage to ‘en’