LocalizationAPI
Defined in: i18n/Localization.ts:57
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).
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new LocalizationAPI(
locale?,fallback?):LocalizationAPI
Defined in: i18n/Localization.ts:63
Parameters
Section titled “Parameters”locale?
Section titled “locale?”string = 'en'
fallback?
Section titled “fallback?”string = 'en'
Returns
Section titled “Returns”LocalizationAPI
Accessors
Section titled “Accessors”fallbackLocale
Section titled “fallbackLocale”Get Signature
Section titled “Get Signature”get fallbackLocale():
string
Defined in: i18n/Localization.ts:79
Returns
Section titled “Returns”string
locale
Section titled “locale”Get Signature
Section titled “Get Signature”get locale():
string
Defined in: i18n/Localization.ts:76
Returns
Section titled “Returns”string
Methods
Section titled “Methods”addCatalog()
Section titled “addCatalog()”addCatalog(
locale,entries):void
Defined in: i18n/Localization.ts:69
Merge entries into a locale’s catalog (later calls override keys).
Parameters
Section titled “Parameters”locale
Section titled “locale”string
entries
Section titled “entries”Returns
Section titled “Returns”void
availableLocales()
Section titled “availableLocales()”availableLocales():
string[]
Defined in: i18n/Localization.ts:87
Locales that have a catalog, in insertion order.
Returns
Section titled “Returns”string[]
has(
key):boolean
Defined in: i18n/Localization.ts:92
True if the key resolves in the active locale or the fallback.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”boolean
setFallbackLocale()
Section titled “setFallbackLocale()”setFallbackLocale(
locale):void
Defined in: i18n/Localization.ts:78
Parameters
Section titled “Parameters”locale
Section titled “locale”string
Returns
Section titled “Returns”void
setLocale()
Section titled “setLocale()”setLocale(
locale):void
Defined in: i18n/Localization.ts:75
Parameters
Section titled “Parameters”locale
Section titled “locale”string
Returns
Section titled “Returns”void
setPluralSelector()
Section titled “setPluralSelector()”setPluralSelector(
locale,selector):void
Defined in: i18n/Localization.ts:82
Override the plural rule for a locale (e.g. languages with few/many).
Parameters
Section titled “Parameters”locale
Section titled “locale”string
selector
Section titled “selector”Returns
Section titled “Returns”void
t(
key,params?):string
Defined in: i18n/Localization.ts:101
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.
Parameters
Section titled “Parameters”string
params?
Section titled “params?”Returns
Section titled “Returns”string