-
Bug
-
Resolution: Done
-
Major
-
DEV backlog
-
-
MOODLE_405_STABLE
-
Moodle Apps - 2024 i3.1, Moodle Apps - 2024 i3.2
In some edge case when changing language the strings that are not translated are displayed in the previous language. (The case is when you choose on the app a language that has a parent, then any other language, and then the parent language.)
The reason is that in the code that manages the parent languages makes an Object.assign that it shouldn't, and this causes the language strings from point 2 to overwrite the parent language strings
To reproduce:
- Put the app in a language that has a parent language (e.g. 'en_us', whose parent is 'en').
- Then change the language to any other language other than 'en' or 'en_us', for example the 'km' language.
- Then change the language to 'en' (note, not 'en_us'). Strings from the language in point 2 are output. If you put it in 'en_us' it comes out fine, it only happens if you select the parent language.
The problem is caused by this line:
const mergedData = Object.assign(parentTranslations, data);
It seems changing it to this code fixes the problem, but we should test it properly:
const mergedData = {
...parentTranslations,
...data,
};