Skip to main content

Function: useI18n()

useI18n(): object

Defined in: useI18n.ts:6

Returns​

defaultLocale​

defaultLocale: string

The locale the defaultMessages are written in. Defaults to en, the source locale of every @ttoss/* package; an app authoring in another language sets it, or every untranslated message reports MISSING_TRANSLATION and its fallback text is formatted with English rules.

intl​

intl: IntlShape

locale?​

optional locale?: string

The locale to render. Changing it after mount loads that locale, exactly as setLocale does.

messages?​

optional messages?: Messages

onError?​

optional onError?: (err) => void

Receives formatting errors from react-intl and errors thrown by loadLocaleData.

Parameters​

ParameterType
errError

Returns​

void

setLocale​

setLocale: (language) => void

Parameters​

ParameterType
languagestring

Returns​

void