Skip to content

API reference / @localizer/translate / Dictionary

Interface: Dictionary<K>
experimental
​

Defined in: types/dictionary.ts:25

Represents a dictionary that provides localization functionality for a specific set of keys.

Type Parameters ​

Type ParameterDescription
KThe type of keys used in the dictionary.

Methods ​

key() ​

Call Signature ​

key(key): Localizable

Defined in: types/dictionary.ts:46

experimental

Retrieves a localizable value associated with the specified key.

Parameters ​
ParameterTypeDescription
keyKThe key to retrieve the localizable value for.
Returns ​

Localizable

A Localizable object representing the localized value.

Call Signature ​

key<T>(key, hasParameters): ValueFormatter<T>

Defined in: types/dictionary.ts:59

experimental

Retrieves a value formatter for a key that requires parameters.

Type Parameters ​
Type Parameter
T extends Record<string, unknown>
Parameters ​
ParameterTypeDescription
keyKThe key to retrieve the value formatter for.
hasParameterstrueA flag indicating that the key requires parameters.
Returns ​

ValueFormatter<T>

A ValueFormatter object for formatting the localized value with parameters.


loadLocale() ​

loadLocale(locale): Promise<void>

Defined in: types/dictionary.ts:35

experimental

Loads the localization data for a specific locale.

Parameters ​

ParameterTypeDescription
localeLocaleCodeThe locale code to load localization data for.

Returns ​

Promise<void>

A promise that resolves when the locale data has been loaded.