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.

Translations is also the type for the translations prop on I18nProvider.

See Translation phrases for every supported key.

Import

import type { Translations } from '@videojs/react/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 { I18nProvider, type Translations } from '@videojs/react/i18n';

const translations = {
  Play: 'Abspielen',
} satisfies Partial<Translations>;

<I18nProvider locale="de" translations={translations}>
  <Player />
</I18nProvider>;

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