Class: abstract
Dictionary
Defined in: packages/core/src/dictionary/Dictionary.ts:21
The Dictionary is a manager and preprocessor of localization phrases for a single language. The format of the localization phrases depends on the implementation of this interface.
Extended by
Constructors
new Dictionary()
new Dictionary():
Dictionary
Returns
Methods
get()
get(
key
,parameters
?):string
Defined in: packages/core/src/dictionary/Dictionary.ts:59
Retrieves the localization phrase identified by the specified key, evaluates the phrase's placeholder expressions using the provided parameters and returns the result.
Parameters
key
never
The key identifying the localization phrase.
parameters?
The map of parameter names to the parameter values to use. Defaults to an empty plain object.
Returns
string
The specified localization phrase with its placeholders evaluated using the provided parameters.
getLanguage()
getLanguage():
string
Defined in: packages/core/src/dictionary/Dictionary.ts:43
Returns the ISO 639-1 language code of the language this dictionary was initialized with.
Returns
string
The language code representing the language of the localization phrases in this dictionary.
has()
has(
key
):boolean
Defined in: packages/core/src/dictionary/Dictionary.ts:71
Tests whether the specified localization phrase exists in the dictionary.
Parameters
key
string
The key identifying the localization phrase.
@returntrue
if the key exists and denotes a single
localization phrase, otherwise false
.
Returns
boolean
init()
init(
config
):void
Defined in: packages/core/src/dictionary/Dictionary.ts:32
Initializes this dictionary with the provided language and localization phrases.
Parameters
config
The dictionary configuration.
Returns
void