Skip to content
FrameworkStyle

createTranslator

Build a typed translator from a resolved translation map

createTranslator wraps the flat map returned by getI18nTranslations and returns a typed translator. Providers call this internally after merging registry, lazy-loaded built-in packs, browser-translated fallback copy, and provider layers. Use it directly for custom UI outside built-in controls.

import { createTranslator, getI18nTranslations } from '@videojs/html/i18n';

const t = createTranslator(getI18nTranslations('fr'), 'fr');
t('buttons.play', { default: 'Play' });
t('seek.forward', { seconds: 5, default: 'Seek forward {seconds} seconds' });

API Reference

Parameters

ParameterTypeDefaultDetails
translations*object & Record<string, string | unde...
locale*string & object | 'ar' | 'az' | 'bs' ...

Return Value

Translator