ILocaleInstance

interface
Internationalisation

Runtime locale adapter contract — provides reactive locale state, a translate function (t), a number formatter (n) and a scoped child adapter factory.

TypeScript

Definition

The TypeScript interface definition as found in the origam source. Click the copy icon to copy the snippet.

typescript

API

Properties

Every property declared by this interface, with its type, optionality and default.

name
required
string
Identifier of the adapter implementation, e.g. "vue-i18n" or "default".
messages
required
ComputedRef<ILocaleMessages>
Reactive computed ref of the full message map for the current locale.
current
required
Ref<string>
Reactive ref of the active locale code, e.g. "en" or "fr".
fallback
required
Ref<string>
Reactive ref of the fallback locale code used when a key is missing.
t
required
(key: string, ...params: unknown[]) => string
Translates a message key with optional interpolation parameters.
n
required
(value: number) => string
Formats a number according to the active locale conventions.
provide
required
(props: ILocaleProps) => ILocaleInstance
Creates a scoped child locale instance for sub-tree overrides.

Ecosystem

Used by

Components and composables that extend or consume this interface.

Usage

Examples

Ready-to-paste code snippets using this interface.

Accessing the locale instance from a component

typescript