T

AddonLocales

An addon's messages, format and useMessages, over en-US and at most one other locale.

type AddonLocales = { … }

Members

dispose() => void

Stops following locale changes and drops the loaded table.

format(key: string, vars?: FormatVars) => string

Formats 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.

The en-US messages inlined in the bundle.

subscribe(listener: () => void) => () => void

Calls the listener when the locale changes or its table loads; returns the remover.

useMessages() => string

Re-renders the component when the locale changes or its table loads. Returns the active locale code, a dependency for useMemo and useCallback over strings.