Creates a new I18nManager instance
Event emitter for missing translation notifications
Configuration object containing loaders, locales, and formatter
Configuration object for the I18n manager Contains default locale, supported locales, loaders, and formatter settings
Reference to the default locale defined inside the config file This is the primary locale used when no specific locale is requested
Check if the translations has been cached or not. Use "reloadTranslations" method to re-fetch translations
True if translations have been loaded and cached
Returns an array of locales supported by the application.
The method returns locales by inspecting the translations, when no explicit supportedLocales are defined inside the config file.
Array of supported locale strings
Returns an object of cached translations. The object is shared by reference and hence mutations will mutate the original copy
Object containing all loaded translations by locale
Returns an object of translations for a given locale
The locale to get translations for
Object containing translations for the specified locale
Returns an instance of the translations formatter for the active formatter. Lazily instantiates the formatter on first access.
The configured translations formatter instance
Returns the most appropriate supported locale based upon the user languages using content negotiation
Single language string or array of preferred languages
The best matching supported locale or null if no match found
Returns the fallback locale for a given locale. Returns the default locale when no fallback is defined or no close match is found
The locale to find a fallback for
The fallback locale string
Returns an instance of I18n for a given locale Uses the default locale if none is provided
Optionallocale: string
Optional locale string, defaults to defaultLocale
New I18n instance for the specified locale
Returns the fallback message for an identifier and locale when the "config.fallback" function is defined.
The translation identifier
The locale to get fallback message for
Fallback message string or undefined if not configured
I18nManager manages translation loading, locale detection, and I18n instance creation. It handles multiple loaders, fallback locales, and caching of translations.
Example