moodle-mod_hvp
moodle-mod_hvp copied to clipboard
Bug or FR: Content Hub localization doesn't respect Moodle language hierarchy
Moodle implements a language hierarchy using https://en.wikpedia.org/wiki/List_of_ISO_639-1_codes . "en" is the base language, while Moodle provides several other language packs.
Each language pack may have a parent language set. If not, "en" is the default fallback.
We defined a custom language pack for our Moodle installation, called for example "de_some", of which the parent language is "de". We didn't publish the language pack because the pack is specific to us.
The problem: It seems the content hub doesn't use the parent language feature. When "de_some" is active, the content hub defaults to "en". When we explicitly set to "de", the content hub also uses "de".
It would be nice if the localization could check if a localization exists, and if not, try the parent language until a matching localization has been found.
Like:
$language = getCurrentLanguage();
$usable = hasLocalization($language);
while (!$usable) {
$language = $language->getParent();
$usable = hasLocalization($language);
}
openContentHub($language);
...or the equivalent in Javascript.
You raise a valuable point, @danowar2k. If a pull request is submitted, I'll happily merge it in.
When I have time, I will try to provide one.
Maybe this would fix the problem? https://github.com/h5p/moodle-mod_hvp/pull/412
The problem now is there doesn't seem to be a way to check if mod_hvp has a localisation for a specific code. Or am I missing something?
Okay, we recently switched from the local langpack "de_some" to storing the customlang version of the language packs "de_local" and "en_local" which makes this change unnecessary for us. So feel free to close this unless other people still have the problem.