@lion/ui
Version:
A package of extendable web components
61 lines (55 loc) • 54.3 kB
Markdown
---
parts:
- API Table
- Localize
- Systems
title: 'Localize: API Table'
eleventyNavigation:
key: API Table >> Localize >> Systems
title: API Table
order: 90
parent: Systems >> Localize
---
# Localize: API Table
## class: `LocalizeManager`
### Fields
| Name | Privacy | Type | Default | Description | Inherited From |
| ---------------------------------- | --------- | --------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | -------------- |
| `formatDateOptions` | public | `object` | `{ /** @type {Map<string, DatePostProcessor>} */ postProcessors: new Map(), }` | The localize system uses (normalized) Intl for formatting dates.
It's possible to customize this output per locale | |
| `formatNumberOptions` | public | `object` | `{ returnIfNaN: '', /** @type {Map<string, NumberPostProcessor>} */ postProcessors: new Map(), }` | The localize system uses (normalized) Intl for formatting numbers.
It's possible to customize this output per locale | |
| `loadingComplete` | public | | | | |
| `locale` | public | | | | |
| `_autoLoadOnLocaleChange` | protected | `boolean` | `!!autoLoadOnLocaleChange` | | |
| `_fallbackLocale` | protected | | `fallbackLocale` | | |
| `_langAttrSetByTranslationTool` | protected | | | | |
| `_showKeyAsFallback` | protected | | `showKeyAsFallback` | | |
| `_supportExternalTranslationTools` | protected | | | | |
### Methods
| Name | Privacy | Description | Parameters | Return | Inherited From |
| ------------------------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- | ----------------------- | -------------- |
| `addData` | public | | `locale: string, namespace: string, data: object` | | |
| `addEventListener` | public | | `type, callback, options` | | EventTarget |
| `dispatchEvent` | public | | `event` | | EventTarget |
| `loadNamespace` | public | | `namespaceObj: NamespaceObject, { locale = this.locale }, options: @param {string} [options.locale] * ` | `Promise<Object\|void>` | |
| `loadNamespaces` | public | | `namespaces: NamespaceObject[], { locale }, options: @param {string} [options.locale] * ` | `Promise<Object>` | |
| `msg` | public | | `keys: string \| string[], vars: Object<string,?>, opts: @param {string} [opts.locale] * ` | `string` | |
| `removeEventListener` | public | | `type, callback, options` | | EventTarget |
| `reset` | public | | | | |
| `setDatePostProcessorForLocale` | public | | `{ locale, postProcessor }, options: {locale:string, postProcessor:DatePostProcessor}` | | |
| `setNumberPostProcessorForLocale` | public | | `{ locale, postProcessor }, options: {locale:string, postProcessor:NumberPostProcessor}` | | |
| `setupNamespaceLoader` | public | | `pattern: RegExp\|string, loader: function` | | |
| `teardown` | public | | | | |
| `_cacheNamespaceLoaderPromise` | protected | | `locale: string, namespace: string, promise: Promise<Object\|void>` | | |
| `_getCachedNamespaceLoaderPromise` | protected | | `locale: string, namespace: string` | | |
| `_getLangFromLocale` | protected | | `locale: string` | `string` | |
| `_getMessageForKey` | protected | | `key: string \| undefined, locale: string` | `string` | |
| `_getMessageForKeys` | protected | | `keys: string \| string[], locale: string` | `string \| undefined` | |
| `_getNamespaceLoader` | protected | | `namespaceObj: NamespaceObject, isDynamicImport: boolean, namespace: string` | | |
| `_getNamespaceLoaderPromise` | protected | | `loader: function, locale: string, namespace: string, fallbackLocale: string` | `Promise<any>` | |
| `_isNamespaceInCache` | protected | | `locale: string, namespace: string` | | |
| `_loadAllMissing` | protected | | `newLocale: string, oldLocale: string` | | |
| `_loadNamespaceData` | protected | | `locale: string, namespaceObj: NamespaceObject, isDynamicImport: boolean, namespace: string` | `Promise<Object\|void>` | |
| `_lookupNamespaceLoader` | protected | | `namespace: string` | `function\|null` | |
| `_onLocaleChanged` | protected | | `newLocale: string, oldLocale: string` | `undefined` | |
| `_setHtmlLangAttribute` | protected | | `locale: string` | | |
| `_setupHtmlLangAttributeObserver` | protected |