Skip to content
FrameworkStyle

createI18n

Factory that creates framework i18n helpers with custom loading options

Import

import { createI18n } from "@videojs/html/i18n";

createI18n returns a context-bound ProviderMixin, TextMixin, and I18nController for custom elements. Use it when you need a custom locale loader or custom i18n elements. Most apps use <media-i18n> and <media-text> from @videojs/html/i18n.

import { ReactiveElement } from '@videojs/element';
import { createI18n } from '@videojs/html/i18n';

const { ProviderMixin, TextMixin } = createI18n();

class LocalizedRoot extends ProviderMixin(ReactiveElement) {}
class LocalizedText extends TextMixin(ReactiveElement) {}

API Reference

Parameters

ParameterTypeDefaultDetails
options{ loader?: LocaleLoader }

Return Value

PropertyTypeDetails
contextContext<symbol, I18nContextValue>
I18nControllertypeof I18nController
ProviderMixinfunction
TextMixinfunction