Provide single endpoint to load all node message catalogs

Replaces potentially dozens of http requests with one or two.
This commit is contained in:
Nick O'Leary
2017-04-21 11:49:35 +01:00
parent bb2649d063
commit 7bd0943412
5 changed files with 46 additions and 22 deletions

View File

@@ -98,6 +98,7 @@ function init() {
function getCatalog(namespace,lang) {
var result = null;
lang = lang || defaultLang;
if (resourceCache.hasOwnProperty(namespace)) {
result = resourceCache[namespace][lang];
if (!result) {
@@ -105,9 +106,6 @@ function getCatalog(namespace,lang) {
if (langParts.length == 2) {
result = resourceCache[namespace][langParts[0]];
}
if (!result) {
return resourceCache[namespace][defaultLang];
}
}
}
return result;