How do I insert the Internationalization(I18N)in my web application?
It 's a complicated thing, or you can do in a short time?
I want translate the messages in English … is that possible?
How do I insert the Internationalization(I18N)in my web application?
It 's a complicated thing, or you can do in a short time?
I want translate the messages in English … is that possible?
Yes i have just read this page…
My question was directed to someone who had just done this work as to facilitate the work telling me how can…
Using Yii::t() function you can do that.
Yes i have read of this function Yii::t()…but where I put???
In the main???In the controller???
You can put everywhere: in a model, or in a controller, but generally you can find them in the views.
Ah ok,now i try to put this function in the view of one of my model and i look what’s happens
But putting this feature only get the internalization??
But how do I tell him I want the English translation?
Pass the argument in the function?
in you application configuration you can set these 2 attributes:
language: the language you want to use for this user. So to use the english translation you set this to ‘en_us’ (for USA english) or ‘en_en’ (for British english).
sourceLanguage: the language you have used when developing your web-application, e.g. ‘it_it’ for italian.
Anywhere in your application (view or source code) where you want to use a string which needs to be translated you use:
Yii::t('yii','Buon giorno')
Some examples:
$messageString=Yii::t('yii','Bellisimo');
<ul>
<li>1. <?php echo Yii::t('yii','Uno'); ?> </li>
<li>2. <?php echo Yii::t('yii','Dos'); ?> </li>
<li>3. <?php echo Yii::t('yii','Tres'); ?> </li>
</ul>
Ok but i don’t understand…if i have a button to translate or other?
I put this but how can translate???
Please read this manual:
http://www.yiiframework.com/doc/guide/topics.i18n
(look for the header ‘Message Translation’)