IMPORTANT fixes needed in langconfig.php

IMPORTANT fixes needed in langconfig.php

by David Mudrák -
Number of replies: 0
Picture of Language pack maintainers

Hi!

This is pretty important message to all language pack maintainers. Please pay attention to it.

While working on a reported issue with the numerical question type, Tim Hunt from the Open University discovered serious problem in many Moodle language packs. Tim realized that the problem with the question type is caused by incorrect definition of the strings "decsep" and/or "thousandssep" in the langconfig.php file (which is displayed as core_langconfig component in the AMOS translator). See MDL-31332 for full Tim's report.

The string "decsep" defines the decimal mark used in the given language. English speaking countries usually use the period character ".", most European and South-American countries use the comma "," for example.

The string "thousandssep" defines the symbol for the thousands separator used in digit grouping.

These symbols are used for formatting and parsing numbers. For example the numerical value of one million dollars and 5 cents would be written as 1,000,000.05 in English and 1.000.000,05 in Czech.

Now you can imagine that having both these strings defined correctly in the language pack is crucial for the correct numbers interpretation and formatting. So I wrote a script that checks all language packs in AMOS and reports eventual problems with these two strings. There are three potential problems with them:

  • The most severe problem appears if both decsep and thousandssep strings are defined but are identical. This is obviously incorrect as these two symbols must be distinguishable. This was detected in Catalan, Greek, Finnish, Croatian, Norwegian, Portuguese, Slovak, Serbian and Swedish language packs.
  • Another problem occurs if one of these string is defined but the other one is left empty (undefined). This is pretty common situation for many language packs that define decsep but leave thousandssep empty. On contrary to what you could intuitively expect, Moodle will use the value defined in the parent language (as it always does for any undefined string). And because the English is considered a parent of all lang packs, the value defined in the English langconfig will be used. This may easily lead to the situation described above: imagine a language pack that defines decsep as "," (comma) and leaves thousandssep undefined (at the moment, cs_utf8 for Moodle 1.x is in this situation for example) . Moodle will use the thousandssep defined in the English - which is "," (comma) again.
  • The least severe problem is when neither decsep nor thousandssep strings are defined. Things would work fine as long as the language does not have the parent language defined. If there is a parent language with these two strings defined incorrectly, the child language inherits the problem. For this reason, it is recommended that every single language pack defines these strings explicitly.

The output of the script mentioned above is attached to this post. To understand the output correctly, let us take a line reading

Invalid decsep and/or thousandssep in Catalan {ca} at 1.9!! 2.0!! 2.1!!! 2.2!! 2.3dev!!

The number of exclamation marks next to the version number indicates the severity of the problem:

  • !!! the most severe problem - both strings defined and they have the same value
  • !! - one of the strings is missing and should be defined
  • ! - both strings are missing

So the line above says that the script detected a problem with decsep/thousandssep strings in the Catalan language pack (ca.zip). The version 2.1 of that language has both strings defined to the same value, one of the strings is missing on other branches.

Dear maintainers, please look at your core_langconfig settings and make sure that these strings are defined correctly for your language. Packages that will still suffer this problem after one week from now will be fixed by a robot to a value that you might not want.

Thank you all for your work on Moodle language packs!