Localization of the Graphical User Interface

otacke's picture

I'm thinking about multi-language support in H5P -- just for GUI elements such as button text or label text, etc. not for the content itself.

Presently, H5P uses the language of its host system for selecting the language. For example, the Wordpress PlugIn seems to fetch the global variable WPLANG from Wordpress, and this determines which language H5P will be presented in. This will probably be fine in most use cases, but in an international context it might be preferable to use the browser language instead if available (navigator.language || navigator.userLanguage) and to fall back to the host system language or English otherwise. Would this be a desirable (optional) behavior?

falcon's picture

The idea is that H5P should use the same language as the CMS. In Drupal you may tell Drupal to use the browser language and then H5P would do the same. I don't know how that works in WordPress, but are there use-cases where you'd want H5P's UI strings to be on a different language than the same type of UI strings of the CMS? Maybe when embedded?

otacke's picture

My employer going to host a course for an international audience soon on a moodle system. We can offer content in multiple languages by choosing a language using regular moodle features, but H5P does not switch languages for buttons, etc. So, either we'd need H5P to register when the language is switched (pages get reloaded), or H5P would simply use the visitor's language. However, we're not running the latest moodle plugin yet, so maybe this can already be achieved.

For me personally, I set up my "labs page" using Wordpress, and I'd love to present my visitors H5P content -- or at least the GUI in this case -- in their language if possible. I was thinking that checking the browser's language was the easiest way to achieve that.

falcon's picture

In H5P the interface strings are part of the content so it isn't possible to have them in one language and the content in another. I don't think anyone in the core team is familiar with the multilingual features of Moodle. We know how to make sure we support different languages, but we have to look into multilingual content. I've created an issue for it.

oncampus's picture

That's why he (= I, wrong account :-) ) was talking about the GUI only, but not the content ;-)

falcon's picture

Translation is a bit different in H5P since it is possible for authors to customize all strings, also the "GUI" strings like "Check, retry, previous, next". It makes GUI only translations harder but also gives author more control.

otacke's picture

BTW: Is there a way (planned) to do that "globally"? There might be some cases where it's a little tedious to replace the same string over and over again.

tim's picture

Yes, probably further down the line. 

I am not familiar with technical matters much, but moodle has a function called multi-language contents filter.
https://docs.moodle.org/28/en/Multi-language_content_filter

So, even in H5P, it is helpful to embed it, tags, flags in content can specify language.

otacke's picture

Thanks for the hint! ありがとう。That's the way my employer adds content in different languages to moodle.

On the one hand, even if you added the class definition to H5P, there still would have to be a way to communicate between moodle and H5P in order to update the content whenever someone changes the language. On the other hand, H5P is not moodle-only, and there might be a better way to implement a multi-language feature that works with other host environments as well.

otacke's picture

Just stubled upon ticket HFP-1188. You're awesome!

tomaj's picture

I'm happy that you're happy! :) And I think it will be very useful for quickly creating content in multiple languages.

- Tom