Hello,
from the documentation you can read:
So in your config file you may set:
'sourceLanguage' => 'en_us',
And then do:
Yii::app()->setLanguage('it_it');
to set it to Italian language.
If I’m right, this should define both localization and internationalization so I should be able to get system messages in italian and also other information like date format and currency.
So for example if I want to have italian language for Switzerland, that doesn’t uses the Euro, I should set it to “it_ch”…
But using the locale id in the LanguageID_RegionID format leads to the problem that the system messages are mainly using only the "LanguageID" format… (in the framework "messages/" folder)
And if using the getPreferredLanguage() method, I could get the Locale ID (from my browser) in the LanguageID_RegionID format (“it_it”) but then, in order to have system messages to work, I’d have to do something like this:
$language =Yii::app()->request->getPreferredLanguage();
$language = substr($language, 0, 2);
Yii::app()->setLanguage($language);
…to grab only the LanguageID part…
but in this way I would loose the information about the “RegionID” so it won’t work for Switzerland (it_ch), right?
So my question is: is there a way to keep the locale id in the LanguageID_RegionID and at the same time grab the translations only in the LanguageID format?
Thanks.
bye,
Giovanni.