Constructs a translations module instance setting the active language to the one as persisted using the storageProvider property.
Note that if you are using a forward predicate, make sure to always return ISO-639-1:2002 compliant language codes or the i18n features may break.
The currently active language.
The currently active language (defaults to "en").
The default language to use if none was persisted by the user before (defaults to "en").
The default storage key as used by the persistence layer to store the active language.
Translation helper method for the active language. This
method uses the translations to find the corresponding
value for {@param translationKey}.
A warning will be issued on the console if a translation
key is untranslated and requested here.
Proxy method for $t.
Getter method for the active language. This method uses the storageProvider to read the persisted language, or falls back to using the default if none was persisted before.
Proxy method for $t.
Generated using TypeDoc
This class handles translation keys and persistence of the currently active user language in a browser environment. We highly recommend using the snake_case format for translation keys to avoid keys duplication and invalid keys content.
You can augment and extend this class using protected properties as listed below.
Warning: This class serves as a base for the translations system as used in this software, modifying or extending can potentially break your software. Please, always make sure to check your translation files.
Using the Translations class
Properties
The currently active language (defaults to "en").
The translations dataset (translated keys).
v0.1.0