moodle-mod_hvp icon indicating copy to clipboard operation
moodle-mod_hvp copied to clipboard

Bug or FR: Content Hub localization doesn't respect Moodle language hierarchy

Open danowar2k opened this issue 7 years ago • 5 comments

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.

danowar2k avatar Dec 28 '17 10:12 danowar2k

You raise a valuable point, @danowar2k. If a pull request is submitted, I'll happily merge it in.

timothyylim avatar Jan 11 '18 08:01 timothyylim

When I have time, I will try to provide one.

danowar2k avatar Jan 26 '18 13:01 danowar2k

Maybe this would fix the problem? https://github.com/h5p/moodle-mod_hvp/pull/412

danowar2k avatar Jun 08 '21 15:06 danowar2k

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?

danowar2k avatar Jun 08 '21 15:06 danowar2k

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.

danowar2k avatar Jan 24 '22 15:01 danowar2k