In ‘yii\messages\’ I have 27 subfolders, each for one language, starting from ‘bg’, ‘bs’, ‘de’, ‘el’, ‘es’, ‘fr’ etc… and finally ‘pl’ for ‘Polish’, which I’m looking for.
Yii::app()->sourceLanguage is set to "en_us".
I’m changing Yii::app()->language in ‘config/main.php’ to each of above and testing on non-existing view. And…
bg - not working? - "The requested view "about" was not found."
bs - working! - "zahtjevani pogled (view) "about" nije pronađen."
de - working! - "Der angeforderte View "about" wurde nicht gefunden."
el - working! - "Δεν ήταν δυνατή η εύρεση της όψης "about"."
es - not working? - "The requested view "about" was not found."
fr - not working? - "The requested view "about" was not found."
pl - not working? - "The requested view "about" was not found."
Am I missing something? Why it works for a bunch of languages and doesn’t work for others? I’ve checked yii.php files in each of above mentioned folders and each of them exists and each of them containst phrase “The requested view…” translated properly…
And what about http://www.yiiframework.com/doc/guide/topics.i18n? Because I’m reading “Message Translation” part for fifth time now and still missing something. When all I need to do is to change Yii::app()->language in config and when I have to use Yii::t()? If Yii has so many messages already translated then what is a reason for using t() for doing on-the-fly translation?
I’m answering myself. Translation works fine in PL and probably any other languages. Only Yii seems to be caching it or in any other way somehow preventing from immediate use. In my situation translation started to work within around 15 minutes after changing config file.
No, for 100% I DON’T. I’m talking about base Yii app, build using yiic.bat in which I only changed language in the configuration. As far as I know it does not introduce any caching system and I for sure does not introduced it myself as the only thing I did with it, was to change language in configuration and delete static page from demo to see message saying that this page was not found. I’m pretty sure that translation of this and any other webapp element started working about 15-20 minutes after language change in configuration.
I have no other explanation like this is related to using some kind of caching system. But AFAIK Yii does not use it in base demo application and so my server isn’t (I’m running this app in developement environment on localhost with XAMPP Lite).
I’m talking about default message saying that page or view was not found - core framework message. Not about any nationalized / not already translated mesages.
Conclusion: Translation to Polish in my case started to work, so we can close this topic. I didn’t test changing language to any other again to see if translation start working immediately or with 15-20 minutes delay, as I don’t need such test. It is only interesting / surprising that it took so much time and I already started to google around to see why it is not working?