Jump to:

5537 Posts in 1737 Topics by 1223 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Empty message boxes with i18n::set_default_locale

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 970 Views
  • inCharge
    Community Member
    102 Posts

    Empty message boxes with i18n::set_default_locale Link to this post

    In SilverStripe 2.4, calling i18n::set_default_locale with anything other that en_US causes empty message boxes in the CMS.

    To recreate this behaviour (or behavior if you're en_US!), add to _config.php ...


    ...then log into the CMS (or refresh if already logged in). Edit a page and navigate away without saving. Instead of 'Are you sure you want to navigate away from this page', you get an empty message box.

    The reason I want to call i18n::set_default_locale('en_GB') is so new users are automatically assigned the right interface language when they are created via the grid (which only has First Name, Last Name, Email, and Password fields) rather than by clicking 'Add Member'. What's the correct way to set the default language that doesn't have undesirable side effects?

    Note: this is about setting the language in the CMS e.g. so people using the CMS see a 'Behaviour' tab not a 'Behavior' tab. This is not about making the resulting site translatable.

  • inCharge
    Community Member
    102 Posts

    Re: Empty message boxes with i18n::set_default_locale Link to this post

    Solved, kind of...

    Messages for CMS popups are available for the following locales (as of SS 2.4):


    The language files are stored in cms/javascript/lang

    Either the logged in user's locale (i.e. the interface language selected in their profile) or the default locale must be one of those languages, otherwise popups are empty.

    To use a default local that is not one of the 5 available, copy one of those JavaScript language files and rename the locale code in the file name and the file content.

    e.g. Copy en_US.js to en_GB.js and change the line...

    ss.i18n.addDictionary('en_US', {


    ss.i18n.addDictionary('en_GB', {

    For languages where there is not a close equivalent, it would not take long to translate as there are only 35 short messages.

    Bear in mind when doing this, care needs to be taken when upgrading SilverStripe.

    Are 3rd party translations of these files available and stored somewhere else?
    Why is the CMS avaliable in 40 languages (see cms/lang) but the popups are only in 5 languages?

  • martimiz
    Forum Moderator
    1078 Posts

    Re: Empty message boxes with i18n::set_default_locale Link to this post

    Just to add to that: seems there are quite some translations missing from the files in that directory. For anyone interested, I do have an extended dutch version, that covers most (I hope). I could convert it to an en_US, so others could take it from there...

    There are more missing/incomplete javascript language files like that hanging around. I did send in patches before, but they just keep popping up, and I'm not that into git yet...

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.