• Resolved Bence Szalai

    (@grapestain)


    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 and languages parameter. So after all what would be needed is a way to be able to access videojs so we could call videojs.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?

    • This topic was modified 2 years, 7 months ago by Bence Szalai.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Bence Szalai

    (@grapestain)

    Actually I’ve monkey-patched the videopress.js file to expose videojs and fire an Event once it is loaded, so I could call videojs.addLanguage(). Happily loading languages from here work like charm: https://github.com/videojs/video.js/tree/main/lang

    So please expose an API to allow either directly interacting with the included video.js or a way to load translations from the theme author/site admin perspective.

    Honestly, if VideoPress simply automatically loaded the translations of the languages installed on the given WordPress, that would be the best, as than it’d be not a site admin responsibility to keep the translations up to date.
    Bu than the “Loading…” message would still be a problem as that’s not a string in Video.js, but in VideoPress… Still, 99% of the UI would be fine without any need for manual translations, as the translations are there, ready to be used.

    Plugin Support lastsplash (a11n)

    (@lastsplash)

    Hi @grapestain

    We checked in with our development team on this and translations are not supported yet in VideoPress player. It is something they hope to add later this year.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to translate JetPack VideoPress player UI’ is closed to new replies.