Provides internationalization managers for translation files and locale handling.
npm i @gasket/intl @gasket/plugin-intl
See @gasket/plugin-intl for more information on how to configure the plugin.
With a intl.js
built by @gasket/plugin-intl, you can use the manager to
get provide messages for locales.
To get all messages for a locale:
import intlManager from '../path/to/intl.js';
const messages = intlManager.getLocale('en-US').getAllMessages();
This will return a handler with the following methods:
// Access a locale handler
const localeHandler = intlManager.getLocale('en-US');
// locale files can be dynamically loaded
await localeHandler.load('locales/examples')
// Get all loaded messages for a locale
localeHandler.getAllMessages();