Skip to content

LocalizationAPI

Defined in: i18n/Localization.ts:58

Per-App localization service: catalogs keyed by locale, an active locale + a fallback, and t() resolution (active → fallback → the key itself). Published as the Localization resource; read it as app.getResource(Localization).

new LocalizationAPI(locale?, fallback?): LocalizationAPI

Defined in: i18n/Localization.ts:66

string = 'en'

string = 'en'

LocalizationAPI

get fallbackLocale(): string

Defined in: i18n/Localization.ts:83

string


get locale(): string

Defined in: i18n/Localization.ts:80

string

addCatalog(locale, entries): void

Defined in: i18n/Localization.ts:72

Merge entries into a locale’s catalog (later calls override keys).

string

LocaleCatalog

void


availableLocales(): string[]

Defined in: i18n/Localization.ts:97

Locales that have a catalog, in insertion order.

string[]


has(key): boolean

Defined in: i18n/Localization.ts:102

True if the key resolves in the active locale or the fallback.

string

boolean


setFallbackLocale(locale): void

Defined in: i18n/Localization.ts:82

string

void


setLocale(locale): void

Defined in: i18n/Localization.ts:79

string

void


setPluralSelector(locale, selector): void

Defined in: i18n/Localization.ts:92

Override the plural rule for a locale (e.g. languages with few/many).

string

PluralSelector

void


setPseudoLocalization(options): void

Defined in: i18n/Localization.ts:86

Opt-in length stress preview. Pass null to restore ordinary translation.

PseudoLocalizationOptions | null

void


t(key, params?): string

Defined in: i18n/Localization.ts:111

Translate key, interpolating {params}. A pluralized entry selects a form from params.count (default 0). Unknown keys return the key itself (a visible, greppable fallback) rather than throwing.

string

TParams

string