Language customizations lost on upgrade

Language customizations lost on upgrade

by James Mackinnon -
Number of replies: 3

Hi all,

I've been running a test upgrade of a Moodle 1.9 site to 2.2, and it appears that the language customizations are lost. Looking in the moodledata dir, the "lang" dir gets renamed to "oldlang" and nothing seems to be moved across. Is this expected behaviour, or am I doing something wrong?

Thanks for any help!

Average of ratings: -
In reply to James Mackinnon

Re: Language customizations lost on upgrade

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Yes, this is expected behaviour. The upgrade process just renames the directory with your local modifications of the language pack but you have to prepare the correct syntax for the local string files for 2.x manually (alternatively you can re-edit them via the inbuilt tool that saves them in correct syntax).

Note there are several differences in how strings are formatted in 1.x and 2.x, most notably in the $a placeholders handling (must be wrapped in curly braces in 2.x) and no more exceptions for the percentual sign (no more need to have %% in 2.x to display %).

Hope this helps.
Average of ratings: Useful (2)
In reply to David Mudrák

Re: Language customizations lost on upgrade

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hi David,

A related question, just to be sure : this is the case when upgrading from 1.9 to 2.x !

But, if you upgrade from 2.0 to 2.2 (for example), do you loose your local modifications (or not, because files are defined the same way) ?

Average of ratings: Useful (1)
In reply to Séverin Terrier

Re: Language customizations lost on upgrade

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

This just affects upgrades from 1.9 to 2.x because there was the syntax change. During the upgrade from 2.x to 2.y, the local customizations are not lost.

By the way, if somebody is interested, there is a method in AMOS code that is able to convert strings from 1.x format to 2.x one. Some volunteer might want to use it as a start point for writing a tiny script that would convert all _local packs from 1.x to the new format. See the fix_syntax() definition at https://github.com/moodlehq/moodle-local_amos/blob/master/mlanglib.php#L642

Average of ratings: Useful (2)