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 Parameter | Description |
---|---|
K | The type of keys used in the dictionary. |
Methods
key()
Call Signature
key(
key
):Localizable
Defined in: types/dictionary.ts:46
Retrieves a localizable value associated with the specified key.
Parameters
Parameter | Type | Description |
---|---|---|
key | K | The key to retrieve the localizable value for. |
Returns
A Localizable
object representing the localized value.
Call Signature
key<
T
>(key
,hasParameters
):ValueFormatter
<T
>
Defined in: types/dictionary.ts:59
Retrieves a value formatter for a key that requires parameters.
Type Parameters
Type Parameter |
---|
T extends Record <string , unknown > |
Parameters
Parameter | Type | Description |
---|---|---|
key | K | The key to retrieve the value formatter for. |
hasParameters | true | A flag indicating that the key requires parameters. |
Returns
A ValueFormatter
object for formatting the localized value with parameters.
loadLocale()
loadLocale(
locale
):Promise
<void
>
Defined in: types/dictionary.ts:35
Loads the localization data for a specific locale.
Parameters
Parameter | Type | Description |
---|---|---|
locale | LocaleCode | The locale code to load localization data for. |
Returns
Promise
<void
>
A promise that resolves when the locale data has been loaded.