glitch with local language pack

glitch with local language pack

by Robert Brenstein -
Number of replies: 4
Per advice on this forum, I have created a new language to customize some strings. I called it de_de and set the parent language to de. Replaced de with de_de in the list of languages in sites menu, disabled caching and threw away the old cache file (had to do it otherwise, de was coming back on the menu each time I reactivated cache). Set de_de as the default language. So far so good.

When the login screen comes on, de_de is set as default (we force everyone to login) as expected. However, once anyone logs in, the selected language in the popup is not de_de but cs (first language on the list) even though the page is displayed correctly using de_de. But it is confusing to users.

This is in 1.4.4+ so I can only hope it works correctly in 1.5. Can I change something so the selection is correct? I won't upgrade to 1.5.x until end of August.
Average of ratings: -
In reply to Robert Brenstein

Re: glitch with local language pack

by Robert Brenstein -
I just spend some time investigating this issue and found the problem.

It has to do with the preferable language set by the user. All users that created their profile before I made the change, have the language set (user table, lang field) to de. This makes the current_language() return de not de_de and, of course, since de is longer available among the listed languages, no menu item is marked selected.

It seems that the session language is not set unless I explicitely select some language from the menu. So I either have to patch Moodle to always set the session language upon login or change the language setting for all users in the database.

This pitfall should be mentioned in the language instructions, particularly those suggesting to create a custom language to overwrite standard translations.
In reply to Robert Brenstein

Re: glitch with local language pack

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
If I understand you correctly: de is not in the langlist, but the files still are available?
In reply to koen roggemans

Re: glitch with local language pack

by Robert Brenstein -
Yes, de is no longer in the language list but the language files are there. The purpose of my using custom language (being forced to until the language extensions are implemented; cf http://moodle.org/mod/forum/discuss.php?d=24501#115956) is to overwrite some of the strings using de as the base language. Having both in the list would be counterproductive. Unfortunately, Moodle acts dumb in this situation.

I thought I fixed it by patching the string recall function by forcing it to use my custom language in place of de if stored as default. However, I just ran into a new but related problem. If I still have de as default and edit my profile without setting new preferred langauge, the stored default is set to the first language on the list whatever that happens to be (this bypasses my patch). So, it seems I should just change user records in the database instead of patching the code.

Does anyone know the MySQL command to selectively change de to de_de? Nonselective change (that is changing all records) would be fine as well since I can fix a couple of non-standards by hand.
In reply to Robert Brenstein

Re: glitch with local language pack

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Yes, change the user records:

   UPDATE user SET lang = 'de_de' WHERE lang = 'de'