List of resource IDs
Function that returns a generator over FluentBundles
Retrieve the translation corresponding to the id
identifier.
If passed, args
is a simple hash object with a list of variables that
will be interpolated in the value of the translation.
Returns a Promise resolving to the translation string.
Use this sparingly for one-off messages which don't need to be retranslated when the user changes their language preferences, e.g. in notifications.
Identifier of the translation to format
Optional
args: ObjectOptional external arguments
Retrieve translations corresponding to the passed keys.
A generalized version of DOMLocalization.formatValue
. Keys must
be {id, args}
objects.
Returns a Promise resolving to an array of the translation strings.
This method should be called when there's a reason to believe that language negotiation or available resources changed.
The
Localization
class is a central high-level API for vanilla JavaScript use of Fluent. It combines language negotiation, FluentBundle and I/O to provide a scriptable API to format translations.