diff --git a/editor/js/i18n.js b/editor/js/i18n.js index 8cdde3250..302cce2b1 100644 --- a/editor/js/i18n.js +++ b/editor/js/i18n.js @@ -19,7 +19,7 @@ RED.i18n = (function() { return { init: function(done) { i18n.init({ - resGetPath: 'locales/__ns__', + resGetPath: 'locales/__ns__?lng=__lng__', dynamicLoad: false, load:'current', ns: { @@ -38,6 +38,31 @@ RED.i18n = (function() { }, loadCatalog: function(namespace,done) { i18n.loadNamespace(namespace,done); + }, + + loadNodeCatalogs: function(done) { + var languageList = i18n.functions.toLanguages(i18n.detectLanguage()); + var toLoad = languageList.length; + + languageList.forEach(function(lang) { + $.ajax({ + headers: { + "Accept":"application/json" + }, + cache: false, + url: 'locales/nodes?lng='+lang, + success: function(data) { + var namespaces = Object.keys(data); + namespaces.forEach(function(ns) { + i18n.addResourceBundle(lang,ns,data[ns]); + }); + toLoad--; + if (toLoad === 0) { + done(); + } + } + }); + }) } } })(); diff --git a/editor/js/main.js b/editor/js/main.js index b82d40387..02a8526d6 100644 --- a/editor/js/main.js +++ b/editor/js/main.js @@ -24,22 +24,7 @@ url: 'nodes', success: function(data) { RED.nodes.setNodeList(data); - var nsCount = 0; - for (var i=0;i