5102 Posts in 1520 Topics by 1116 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 777 Views |
-
Empty message boxes with i18n::set_default_locale

25 May 2011 at 6:42am
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 ...
i18n::set_default_locale('en_GB');
...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.
-
Re: Empty message boxes with i18n::set_default_locale

26 May 2011 at 9:49am Last edited: 26 May 2011 9:52am
Solved, kind of...
Messages for CMS popups are available for the following locales (as of SS 2.4):
cs_CZ
de_DE
en_US
fr_FR
sk_SKThe 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', {
...to...
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? -
Re: Empty message boxes with i18n::set_default_locale

28 May 2011 at 10:42pm Last edited: 28 May 2011 10:47pm
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...
| 777 Views | ||
|
Page:
1
|
Go to Top |
