Skip to content
FrameworkStyle

Translations

Partial map of English translation phrases to localized strings

Translations is the shape for locale packs passed to registerI18n and createTranslator. Every entry is optional. Missing keys fall back through the BCP 47 chain, lazy-loaded built-in packs, supported browser translation fallback, and English.

See Translation phrases for every supported key.

Import

import type { Translations } from '@videojs/html/i18n';

Definition

type Translations = {
  [K in keyof TranslationParams]?: TranslationParams[K] extends never
    ? string
    : /* parametric keys must include required {placeholder} tokens */
      string;
};

Parametric values must include the same {placeholder} substrings as English ({seconds}, {duration}, and so on). TypeScript enforces this when you use satisfies Partial<Translations>.

Examples

import { registerI18n, type Translations } from '@videojs/html/i18n';

const es = {
  Play: 'Reproducir',
  Pause: 'Pausa',
  'Seek forward {seconds} seconds': 'Adelantar {seconds} segundos',
} satisfies Partial<Translations>;

registerI18n('es', es);

Only supplied keys override lower layers. See Internationalization for merge priority.