LocaleManager
Singleton
Singleton that handles switching locale. Locales can be included on page with <script> tags or loaded using ajax. When using script tags the first locale loaded is used per default, if another should be used as default specify it on any <script> tag with data-default-locale="En".
Example for Grid (to use for other products replace grid with product name):
index.html:
// Using Ecma 6 modules and source
<script type="module" src="lib/Core/localization/SvSE.js">
// Specify default locale when using bundled locales
<script data-default-locale="En" src="build/locales/grid.locale.En.js">
<script src="build/locales/grid.locale.SvSE.js">
app.js:
// Import using sources
import LocaleManager from 'lib/Core/localization/LocaleManager.js';
// Or using module bundle
import { LocaleManager } from 'build/grid.module.js';
// Set locale using method
LocaleManager.applyLocale('SvSE');
// Or set locale using string property
LocaleManager.locale = 'SvSE';
// Or set locale using locale object property
LocaleManager.locale = LocaleManager.locales.SvSE;
Useful properties and functions
| Property / Function | Description |
|---|---|
| locale | Get or set the current locale |
| locales | All registered locales |
| applyLocale | Apply a locale by name |
See also
- Localizable - Mixin for localized classes
Note: Class is a singleton and all members listed below can be accessed as static ones.
No results
Properties
Properties are getters/setters or publicly accessible variables on this class-
Get/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.
Has a corresponding throwOnMissingLocale config.