T
AddonLocales
An addon's messages, format and useMessages, over en-US and at most one other locale.
type AddonLocales = { … }Members
dispose
() => voidStops following locale changes and drops the loaded table.
format
(key: string, vars?: FormatVars) => stringFormats a message in the active locale, filling its placeholders from vars.
loadedLocales
() => string[]The locales held in memory: en-US, and the active one once it loaded.
Each message in the active locale, falling back to en-US, then the key itself.
source
Readonly<LocaleStrings>The en-US messages inlined in the bundle.
subscribe
(listener: () => void) => () => voidCalls the listener when the locale changes or its table loads; returns the remover.
useMessages
() => stringRe-renders the component when the locale changes or its table loads. Returns the active locale code,
a dependency for useMemo and useCallback over strings.