-
Bug
-
Resolution: Fixed
-
Minor
-
2.9.7, 3.0.5, 3.1, 3.1.2, 3.6.4, 3.7
-
MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
-
MOODLE_36_STABLE, MOODLE_37_STABLE
-
-
Steps to reproduce:
- Ensure that the language packs en, en_us and de are installed on the site.
- Create a page resource in a course and enter the text
<span lang="de" class="multilang">your_content_in_German</span>
<span lang="en" class="multilang">your_content_in English</span>
(disabling the HTMl editor)
- Save the page resource and then try viewing it with en_us selected as preferred user language.
Expected result: 'your_content_in English' is displayed.
Actual result: 'your_content_in_German' is displayed.
see https://moodle.org/mod/forum/discuss.php?d=336204
The problem: if a field has span block for several languages but not for en_us, the multilang filter picks the first span block from the field, ignoring the fact that en_us has en set as its parent language.
To quote David: The English (en) is implicit parent of all language packs in Moodle (so if a string is not translated, the English original is used). In most places in the code, if the parent language is reported to be English (en), it is actually interpreted as if there was no parent language. And I believe this is what is happening here.
Comment: The issue is built-in so to speak for en_us but I think it will also appear when, for example, I use a locally defined language de_de which has de as the parent.
Workaround: set the first span bloc for en (in case of en_us) or whatever the parent language is. Easy to do but requires documentation. Problematic if I have more than one language with different parents is used (like using en_us and de_de on my site).
Solution: The code should distinguish when a given language has parent language set explicitly from when the en is used when no other language is available.
Note: this problem does not exist in Moodle 1.9 (not that this really helps)