javascriptinternationalizationmediaelement.js

MediaElement.js i18n - how to implement?


So you can support multiple languages in the captions and subtitles, and I can see that there is code for i18n. However, I've trawled around the internet trying to find a tutorial on how to implement this and can't find anything.

Theres nothing on the mediaelementjs.com webpage or github wiki and its not obvious.

Also there's only German and Chinese available. I'd like to be able to completely override all the strings required when the player is initialised.

I'm used to implementing i18n in MVC, & jquery ui datepickers etc but this has baffled me.

Thanks in advance


Solution

  • This took me today some hours too.

    The captions and subtitles from the 'mediaelementplayer.js' file are loaded while the javascript loads. (And not (as I expected) when the document is ready or when initializing a new player)

    You have to choose between:

    Example:

    mejs.MepDefaults.fullscreenText = 'Vollbild'
    

    Example:

    // Set mejs translation to German
    mejs.i18n.getLanguage = function() { return 'de' };