mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
docs(site): add i18n type reference pages and review fixes
Add Locale, BuiltInLocale, TranslationParams, Translations, and Translator reference pages plus createTranslator. Cross-link types from concept and guides; fix React examples and register-locale satisfies pattern. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: createTranslator
|
||||
description: Build a typed translator from a resolved translation map
|
||||
---
|
||||
|
||||
import UtilReference from "@/components/docs/api-reference/UtilReference.astro";
|
||||
import DocsLink from "@/components/docs/DocsLink.astro";
|
||||
|
||||
`createTranslator` wraps a <DocsLink slug="reference/translations">`Translations`</DocsLink> map and returns a <DocsLink slug="reference/translator">`Translator`</DocsLink>. Providers call this internally after merging registry, lazy, and prop layers — use it directly for custom UI outside built-in mixins.
|
||||
|
||||
```ts
|
||||
import { createTranslator, getI18nTranslations } from '@videojs/core/i18n';
|
||||
|
||||
const t = createTranslator(getI18nTranslations('fr'), 'fr');
|
||||
t('play');
|
||||
t('seekForward', { seconds: 5 });
|
||||
```
|
||||
|
||||
<UtilReference util="createTranslator" />
|
||||
Reference in New Issue
Block a user