i18n questions


I have some questions about i18n:

  • How can I get the list of months from /framework/i18n/data/<locale>.php

  • I have some messages in protected/messages/de/test.php. These messages are only taken when I set Yii::app()->setLanguage(‘de’); not if I set it to ‘de_de’ or ‘de_at’. What am I doing wrong here?

  • Where do I have to put the central code to detect and set the users language


Question 1:


question 2:

Dont know because I use db messages (check out this extension I just posted)

question 3:

onBeginRequest event is the best place

Thank you. I will try it.

Where would I put the function and register the it to the event?

Its worth it , and not saying that Its because I made it, but because after I made it its very easy to add a new languages to my applications.

create a class called lets say "Bootstrap" with a method "init" (you can call the method and class as you wish)

in you main config file

return array(








PS: the class must be imported, put it in the components folder

Fine, thank you.

When I install your module the class "Controller" could not be found by the loader. Do you habe any idea?

I dont think its related to the module, but with your app, because the controllers in the module extend from CController

anyway, create em empty class "Controller" that extends CController in your components folder

Let me know what you think of the module


Same problem here. The file de.php contains the following array for the wide month names:

    array (

      1 => 'Januar',

      2 => 'Februar',

      3 => 'März',

      4 => 'April',

      5 => 'Mai',

      6 => 'Juni',

      7 => 'Juli',

      8 => 'August',

      9 => 'September',

      10 => 'Oktober',

      11 => 'November',

      12 => 'Dezember',


da_at.php contains just the different month name of the january in austria:

    array (

      1 => 'Jänner',


Now Yii::app()->getLocale()->monthNames contains only an array with this one element 1 => ‘Jänner’ when language is set to de_at.

The class Controller exists and everything works fine if I remove the module. I think I have made an error in the configuration.

I see.

What you did was to replace the old import index in the config doing like:




what you need to do is to just add this line to your old import index:


same with the index components, just add this in your old components index:



  'onMissingTranslation' => array('TranslateModule', 'missingTranslation'),     	


As for your other problem, this seens weird, I’ll do some tests and let you know …

Couldn’t you use always “de” isntead ?

No I dind’t. I have to look. I must have done something wrong there…

I think I have to. I found this old thread here:


But if this fallback isn’t supported why are there onkly the specific changes stored in de_at.php?

Okay, it is installed. Had an error in my configuration. Will try it now…

Okay. It works. Thank you. Has been one point of the specifications! Two suggestions:

  • You have an error in the controller at line 23: function y() insteag of method Yii::y()

  • You should document that the array of the accepted languages has to be configured.


  • I had already corrected when I was looking for the problem you were having. But thanks for pointing it out. Soon I’ll upload a new version.

-True. I just add that in the extension page.

Anyway, thanks for the suggestions, any more suggestions, requests or bugs please let me know in this thread