I’ve trying to translate the summary in the CGridView. There is a property to set the text “summaryText” but as I will be using a lot of these widgets I don’t want to set it on each widget.
I’ve looked the way it tries to translate there is this line in CBaseListView:
if(($summaryText=$this->summaryText)===null)
$summaryText=Yii::t('zii','Displaying {start}-{end} of {count} result(s).');
But I don’t understand where is getting the translation from, in the zii framework folder the messages are empty.
What do you think?
Is it better to create a translation file (CPhpMessageSource) for the app and then on the "summaryText" property of CGridView just set like
Yii::t('app','Displaying {start}-{end} of {count} result(s).');
Or should I try to translate only those messgaes? If so could someone point me where to put the translated Zii messages. I don’t understand why is trying to translate from zii if there is nothing there.
You are completely right, actually the problem is another :
I have this website with content in english targeted to english users, but the persons who manage the site are portuguese so one module (admin) should be targeted to Portuguese(pt) users. If I set
in config "language"=>"en" then in the admin module translation will not occur since language = sourceLanguage.
If you’re still interested in an answer, have a look at the page on i18n: “One can configure target language in the application configuration, or change it dynamically before any internationalization occurs.”
It unfortunately lacks an example, but I can show you untested code for a i18n partly "de" and "pr". In the configuration file "config/main.php" it looks like