mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
21 lines
831 B
Plaintext
21 lines
831 B
Plaintext
---
|
|
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/html/i18n';
|
|
// or @videojs/react/i18n
|
|
|
|
const t = createTranslator(getI18nTranslations('fr'), 'fr');
|
|
t('Play');
|
|
t('Seek forward {seconds} seconds', { seconds: 5 });
|
|
```
|
|
|
|
<UtilReference util="createTranslator" />
|