Skip to content
FrameworkStyle

useTranslator

React hook that returns the typed translator for the nearest I18nProvider

useTranslator returns the translator from the nearest I18nProvider. Control components pass current English phrases from core getLabel() — for example t('Play') and t('Seek forward {seconds} seconds', { seconds: 10 }).

When no provider is mounted, the hook falls back to English registry strings so standalone demos do not throw.

import { useTranslator } from '@videojs/react/i18n';

function PlayLabel() {
  const t = useTranslator();
  return <span>{t('Play')}</span>;
}

API Reference

Return Value

Translator