How to translate JetPack VideoPress player UI
-
Hi!
We are planing to use JetPack VideoPress to host video content for some of our articles in a new site. We would like to ensure the player UI is shown to the visitoras in the native language of the website (Hungarian).
Is there a supported way to tarnslate the player UI texts, e.g.: Mute, Quality, Captions etc.
During investigation of another issue I’ve already figured out that the standard video block gets rendered using an IFRAME, so thats impossible to programatically interact with the contents of that (no cross scripting possible because of different source domain).
Regarding the IFRAME version I was thinking maybe there’s an undocumented query parameter to be added to the source URL to indicate what language to load (e.g. https://videopress.com/embed/…&lang=hu_HU or similar). But it is not really possible to guess, so this is a question, but also a dead-end for my investigations.
Now if I rather look at the shortcode usage (e.g.: [videopress {guid}]) it is possible to avoid the IFRAME embed using the
jetpack_videopress_player_use_iframe
filter. So great, if this filter returns false the shortcode renders the video as a non-IFRAME HTML5 player.
The problem is similar however to the IFRAME one: There is no documented API to set the player language explicitly.Looking at the shortcode implementation it looks like there’s a
defaultLangCode
parameter for the player, however it is ignored by the actual JavaScript player loaded from https://s0.wp.com/wp-content/plugins/video/assets/js/videojs/videopress.js.
So that’s one side, that it is not really possible to set the desired language of the player.But on the other hand it is indeed only meaningful if the given language is available. Now while I doubt you would have the exact translation I’m looking for, it would be needed not only to be able to set the player language, but also to provide it with the required translations.
What is obvious from the JavaScript code that it uses Video.js as the player, which indeed supports translations by the
language
andlanguages
parameter. So after all what would be needed is a way to be able to accessvideojs
so we could callvideojs.addLanguage()
to set up a custom translation.So question after all: is there a way to translate the player UI, and if so, how is that possible?
- The topic ‘How to translate JetPack VideoPress player UI’ is closed to new replies.