MessageFormatDictionary

dictionary/MessageFormatDictionary~ MessageFormatDictionary

Implementation of the Dictionary interface that relies on compiled MessageFormat localization messages for its dictionary.

Constructor

new MessageFormatDictionary()

Source:
Initializes the dictionary.

Members

_dictionary :Object.<string, Object.<string, function(Object.<string, (number|string)>): string>>

Source:
Stored dictionary.
Type:
  • Object.<string, Object.<string, function(Object.<string, (number|string)>): string>>

_language :string

Source:
The language of the phrases in the dictionary, represented as a ISO 639-1 language code.
Type:
  • string

Methods

get(key, parametersopt)

Source:
Parameters:
Name Type Attributes Description
key string The key identifying the localization phrase. The key consists of at least two parts separated by dots. The first part denotes the name of the source JSON localization file, while the rest denote a field path within the localization object within the given localization file.
parameters Object.<string, (boolean|number|string|Date)> <optional>
The map of parameter names to the parameter values to use. Defaults to an empty plain object.

getLanguage()

Source:

has(key)

Source:
Parameters:
Name Type Description
key string The key identifying the localization phrase. The key consists of at least two parts separated by dots. The first part denotes the name of the source JSON localization file, while the rest denote a field path within the localization object within the given localization file.

init(config)

Source:
Parameters:
Name Type Description
config Object The dictionary field contains the localization phrases organized in a deep plain object map. The top-level key is the name of the phrase group, the bottom-level key is the phrase key. The bottom-level value is the localization phrase generator that takes the phrase placeholder values map as an argument and produces the localization phrase with its placeholders evaluated using the provided placeholder values.