Kamod i18n
API Reference#
createI18n(options)#
Creates an isolated I18n instance.
locale: initial locale; must be eagerfallbackLocale: fallback and schema locale; must be eagermessages: locale names mapped to message objects or lazy loadersonMissingKey?: callback for keys missing from the complete lookup chain
I18n#
locale: active localefallbackLocale: configured fallback localelocales: available locale namest(key, values?): translate and interpolate synchronouslysetLocale(locale): load and activate a localesubscribe(listener): subscribe to locale changes; returns an unsubscribe functionnumber(value, options?): format withIntl.NumberFormatdate(value, options?): format withIntl.DateTimeFormatrelativeTime(value, unit, options?): format withIntl.RelativeTimeFormatlist(values, options?): format withIntl.ListFormat
Exported types#
The core entry point exports Messages, MessageKey, MessageTree, PluralMessage, PluralCategory, InterpolationValues, MissingKeyInfo, CreateI18nOptions, I18n, Listener, and Unsubscribe.
The Preact entry point exports I18nProvider, useI18n, useLocale, I18nProviderProps, and UseLocaleResult.