addData | public | | locale: string, namespace: string, data: object | | |
setupNamespaceLoader | public | | pattern: RegExp|string, loader: function | | |
loadNamespaces | public | | namespaces: NamespaceObject[], { locale }, options: @param {string} [options.locale] * | Promise<Object> | |
loadNamespace | public | | namespaceObj: NamespaceObject, { locale = this.locale }, options: @param {string} [options.locale] * | Promise<Object|void> | |
msg | public | | keys: string | string[], vars: Object<string,?>, opts: @param {string} [opts.locale] * | string | |
teardown | public | | | | |
reset | public | | | | |
setDatePostProcessorForLocale | public | | { locale, postProcessor }, options: {locale:string, postProcessor:DatePostProcessor} | | |
setNumberPostProcessorForLocale | public | | { locale, postProcessor }, options: {locale:string, postProcessor:NumberPostProcessor} | | |
_setupTranslationToolSupport | protected | This value allows for support for Google Translate (or other 3rd parties taking control
of the html[lang] attribute).
Have the following scenario in mind:
1. locale is initialized by developer via html[data-localize-lang="en-US"] and
html[lang="en-US"]. When localize is loaded (note that this also can be after step 2 below),
it will sync its initial state from html[data-localize-lang]
2. Google Translate kicks in for the French language. It will set html[lang="fr"].
This new language is not one known by us, so we most likely don't have translations for
this file. Therefore, we do NOT sync this value to LocalizeManager. The manager should
still ask for known resources (in this case for locale 'en-US')
3. locale is changed (think of a language dropdown)
It's a bit of a weird case, because we would not expect an end user to do this. If he/she
does, make sure that we do not go against Google Translate, so we maintain accessibility
(by not altering html[lang]). We detect this by reading #localeSetByTranslationTool:
when its value is null, we consider Google translate 'not active'.
When Google Translate is turned off by the user (html[lang=auto]),
`localize.locale` will be synced to html[lang] again
Keep in mind that all of the above also works with other tools than Google Translate,
but this is the most widely used tool and therefore used as an example. | | | |
_setHtmlLangAttribute | protected | | locale: string | | |
_setupHtmlLangAttributeObserver | protected | | | | |
_teardownHtmlLangAttributeObserver | protected | | | | |
_isNamespaceInCache | protected | | locale: string, namespace: string | | |
_getCachedNamespaceLoaderPromise | protected | | locale: string, namespace: string | | |
_loadNamespaceData | protected | | locale: string, namespaceObj: NamespaceObject, isDynamicImport: boolean, namespace: string | Promise<Object|void> | |
_getNamespaceLoader | protected | | namespaceObj: NamespaceObject, isDynamicImport: boolean, namespace: string | | |
_getNamespaceLoaderPromise | protected | | loader: function, locale: string, namespace: string, fallbackLocale: string | Promise<any> | |
_cacheNamespaceLoaderPromise | protected | | locale: string, namespace: string, promise: Promise<Object|void> | | |
_lookupNamespaceLoader | protected | | namespace: string | function|null | |
_getLangFromLocale | protected | | locale: string | string | |
_onLocaleChanged | protected | | newLocale: string, oldLocale: string | undefined | |
_loadAllMissing | protected | | newLocale: string, oldLocale: string | | |
_getMessageForKeys | protected | | keys: string | string[], locale: string | string | undefined | |
_getMessageForKey | protected | | key: string | undefined, locale: string | string | |