Skip to content
FrameworkStyle

Locale

BCP 47 language tag type for i18n registry and provider APIs

Locale is the BCP 47 tag type used by registerI18n and provider APIs. Shipped tags autocomplete, and any other BCP 47 tag remains valid at runtime.

Import

import type { Locale } from '@videojs/react/i18n';

Definition

type Locale = (typeof LOCALES)[number] | (string & {});

The (string & {}) pattern keeps custom tags ('xx', 'en-US') type-safe without losing autocomplete for shipped tags.

Provider use

Pass a Locale to the locale prop on I18nProvider, or omit the prop to inherit lang.

Resolution

Providers and getI18nTranslations normalize tags and walk the parent chain (es-MXesen) via findLocaleKeys. See Internationalization for explicit and ambient resolution.