Readonly
onWhen triggered all previously translated strings will be retranslated.
Protected
getOverride this method in a subclass to provide actual translations. Simply return the translated string or undefined if the string doesn't exist.
The translation key, translation source, or default translation
The translation parameter object, this can be used to apply more advanced pluralization rules.
The translated string or undefined
if not found.
Translate a string for use with _.
Translation key
Translation parameter object
Translate a string for use with _n.
Translation key
Translation key, plural
Translation parameter object
A translation provider that doesn't translate strings but does implement parameter interpolation via braces (e.g.
_('Hello, {name}!', {name: 'World'})
).When used with _n it will also use the plural string when
n
is not equal to 1 or -1.This class can be extended to implement a simple translation provider with the above mentioned features. Simply override the getMessage method.