Skip to content
FrameworkStyle

media-i18n

HTML custom element that resolves locale and supplies translations to descendants

<media-i18n> applies the i18n provider mixin to a subtree. Wrap a player, standalone controls, or one of several players that need different locales with this element. Without it, HTML controls use English defaults.

Set lang on the provider or an ancestor. Built-in packs lazy-load automatically; register locale strings with registerI18n when you need custom copy or synchronous first paint. See Translation phrases for supported keys.

<script type="module">
  import '@videojs/html/i18n';
  import '@videojs/html/i18n/locales/es/register';
</script>

<media-i18n lang="es">
  <media-text>Play</media-text>
</media-i18n>

Attributes

Attribute Description
lang Forces the active BCP 47 locale for this subtree. Omit to inherit the nearest ancestor [lang].