i18n setup problem

Hi, I can’t figure out how to use it…

In main.php I set ‘sourceLanguage’ => ‘ru’,

I have file /messages/ru/z.php

and there I have




<?php

return array(

	'z2' => 'test',

);



In my view I use




echo Yii::t('z', 'z2');



And I get ‘z2’ instead of ‘test’…

what I’m doing wrong?

I think the problem is ‘language’=> ‘ru’

according to the tutorial it should be ‘ru_RU’ for example, cause they need to be different…

Hi,

when you define your source language as ‘ru’ and set the language to be also ‘ru’ then your Yii::t(‘category’, ‘message’) is not translated because it is the language you are writing your source with. When you set sourceLanguage to be different then ‘ru’ and your language to ‘ru’, then your message is going to be translated as you expected.

Thank for the response…

SO if for example I want to create ‘ru’ translation, I need to define the source language as ‘en’ or something?

So what is the point to change the source language? cause if for example I change it to ‘ru’ the core messages of we don’t change they stay in english…

cause the core "sourcelanguage" is english…

don’t get it :blink:

You may want to read this discussion.

/Tommy

The point is to develop your application with your native language. Not every php developer/webdeveloper is multilingual :)

and usually translation is done at the end of developing.

According to api:

when you change the sourceLanguage to ‘ru’ all system messages (if there is valid translation file) are displayed in ‘ru’. Otherwise they are displayed as used with Yii::t().

And to answer your question: yes, target language should be different than source language for translation to take place