i18n need help

Hello,

First of all, I read lot of topics in the forum, and read the manual but I still do not understand something.

I set in the config file :

	'language'=>'fr',


    'sourceLanguage'=>'en', 

After that I’ve created multiple folders :

messages/fr

message/de

messages/en

And put a file :blog.php in each folder like the following :

array(


'Leave a Comment'=>'Laisser un commentaire',


'username'=>'Nom d'utilisateur',


'Submit'=>'Envoyer',


'comments'=>' commentaires',


'One comment'=>'Un commentaire',


'to'=>'pour',


'Your email address will not be published.'=>'Votre adresse email ne sera pas publiée.',


'You may use '=>'Vous devez utiliser ',


'Please enter the letters as they are shown in the image above.'=>'Merci de reproduire les lettres comme indiqué sur l'image ci-dessus.',


'Letters are not case-sensitive.'=>'Les lettres ne sont pas sensibles aux majuscules.',


'Preview'=>'Pré-visualisation',


' says:'=>' a dit:',


'Page Not Found'=>'Page non trouvée',


'The page you are looking for cannot be found. Please make sure you entered a correct URL.'=>'The page you are looking for cannot be found. Please make sure you entered a correct URL.',


'If you think this is a server error, please contact'=>'If you think this is a server error, please contact',


'english'=>'Français',


);

When I’am trying to translate with :

echo Yii::t('blog','Leave a Comment');

It doesn't work. Any advice please?

Did you forget 'return' in your message file?

Shame on me :confused:

Thank you…

Just another question I would like to change the language via a link. How can I do that please?

Create a link with URL that is the same as the currently requested URL and with an additional GET parameter to store the needed language ID.

On the server side, you can check this GET parameter in the init() method of controller to set the language accordingly.

Thanks for your help qiang :)