Skip to content
FrameworkStyle

Override translations

Patch individual i18n strings without replacing an entire locale pack

registerI18n merges. Each call adds or replaces phrases for that locale tag without wiping prior registrations. Use this to tweak shipped packs or A/B test copy.

Read Internationalization for merge order and Translation phrases for the supported keys.

Override after a built-in pack

import { registerI18n } from '@videojs/html/i18n';
import '@videojs/html/i18n/locales/es/register';

registerI18n('es', { Play: 'Comenzar' }); // only `Play` changes

Later registrations win for the same phrase. The rest of the es pack stays intact.

HTML reflected text

Use <media-text> for static copy outside buttons:

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

Override the phrase in the registry or set lang on the provider to a locale where you patched Play.

Parametric phrases

Keep required placeholders when overriding:

// ✅
registerI18n('es', { 'Seek forward {seconds} seconds': 'Adelantar {seconds} segundos' });

// ❌ TypeScript error: missing {seconds}
registerI18n('es', { 'Seek forward {seconds} seconds': 'Adelantar' });

What’s next?