Files
v10/site/src/content/docs/reference/i18n-provider.mdx
T
Sam PottsandCursor fd54f36110 docs(site): add i18n concept, guides, and API reference pages
Documents opaque keys, registry APIs, React/HTML providers, and locale
workflows for #1373. Extends api-docs-builder discovery for core/react
i18n exports and adds matching reference MDX pages.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-13 08:22:39 +10:00

29 lines
1.1 KiB
Plaintext

---
title: I18nProvider
description: React provider that resolves locale and supplies a typed translator to descendants
---
import UtilReference from "@/components/docs/api-reference/UtilReference.astro";
import DocsLink from "@/components/docs/DocsLink.astro";
import FrameworkCase from "@/components/docs/FrameworkCase.astro";
<FrameworkCase frameworks={["react"]}>
`I18nProvider` resolves the active locale, merges registry and lazy pack layers, and exposes a translator through context. Preset skins mount it inside <DocsLink slug="reference/player-container">`Container`</DocsLink> with `langRootRef` on the player shell.
Wrap custom controls or force a locale explicitly:
```tsx
import { I18nProvider } from '@videojs/react/i18n';
<I18nProvider locale="de" translations={{ play: 'Abspielen' }}>
<MyControls />
</I18nProvider>
```
Omit `locale` to inherit the nearest `lang` attribute (via `langRootRef` or `<html lang>`). See <DocsLink slug="concepts/i18n">Internationalization</DocsLink> for merge priority and SSR guidance.
<UtilReference util="I18nProvider" />
</FrameworkCase>