This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.
The L10n API provides access to localization resources (e.g. translated strings) and localization events, as well as information about the current language. It is accessible through the navigator.mozL10n property.
- Returns the code of the currently active language.
- Returns the direction of the currently active language.
- Returns the current state of the L10n context (
- Returns the translation for the given identifier.
- An asynchronous equivalent of L10n.get. Returns a Promise which resolves to the translation for the given identifier.
data-l10n-argsattributes on an element.
- A callback that executes at least once, when the L10n context is or becomes ready (when
complete) and each time the language is changed in the future.
- A callback that executes exactly once, when the L10n context is or becomes ready (when
L10n is not part of any specification; note however that this API will be replaced by L20n in the future.