LocaleManager
Configs
1
Configs
1Specifies if Localizable.L() function should throw error if no localization is found at runtime.
Properties
3
Properties
3Get/set currently used locale. Setter calls applyLocale.
Get/set currently registered locales. Alias for LocaleHelper.locales.
Specifies if Localizable.L() function should throw error if no localization is found at runtime.
Functions
1
Functions
1Applies a locale by string name or publishes new locale configuration with publishLocale and applies it. If locale is specified by string name, like 'En', it must be published before applying it.
| Parameter | Type | Description |
|---|---|---|
nameOrConfig | String | Locale | String name of locale (for example |
config | Locale | Boolean | Locale object. Pass |
locale object or Promise which resolves with locale object after it was loaded
Events
1
Events
1Fires when a locale is applied
// Adding a listener using the "on" method
localeManager.on('locale', ({ source, locale, locale.oldLocaleName, locale.oldLocaleCode }) => {
});| Parameter | Type | Description |
|---|---|---|
source | LocaleManager | The Locale manager instance. |
locale | Locale | Locale configuration |
locale.oldLocaleName | String | The name (eg, `'En") of the previous locale which was replaced. |
locale.oldLocaleCode | String | The code (eg, `'en-US") of the previous locale which was replaced. |
Event handlers
1
Event handlers
1Called when a locale is applied
new LocaleManager({
onLocale({ source, locale }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | LocaleManager | The Locale manager instance. |
locale | Locale | Locale configuration |
locale.oldLocaleName | String | The name (eg, `'En") of the previous locale which was replaced. |
locale.oldLocaleCode | String | The code (eg, `'en-US") of the previous locale which was replaced. |