mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Load base locales in editor
This commit is contained in:
parent
b2caba593f
commit
0705589cc2
@ -134,6 +134,21 @@ var RED = (function() {
|
|||||||
statusEnabled = state;
|
statusEnabled = state;
|
||||||
RED.view.status(statusEnabled);
|
RED.view.status(statusEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadLocales() {
|
||||||
|
i18n.init({
|
||||||
|
ns: {
|
||||||
|
namespaces: ["editor"],
|
||||||
|
defaultNs: "editor"
|
||||||
|
},
|
||||||
|
fallbackLng: ['en-US']
|
||||||
|
},function() {
|
||||||
|
RED["_"] = function() {
|
||||||
|
return i18n.t.apply(null,arguments);
|
||||||
|
}
|
||||||
|
loadEditor();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function loadEditor() {
|
function loadEditor() {
|
||||||
RED.menu.init({id:"btn-sidemenu",
|
RED.menu.init({id:"btn-sidemenu",
|
||||||
@ -201,7 +216,7 @@ var RED = (function() {
|
|||||||
|
|
||||||
ace.require("ace/ext/language_tools");
|
ace.require("ace/ext/language_tools");
|
||||||
|
|
||||||
RED.settings.init(loadEditor);
|
RED.settings.init(loadLocales);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
3
locales/en-US/editor.json
Normal file
3
locales/en-US/editor.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"foo": "fred"
|
||||||
|
}
|
@ -86,7 +86,7 @@ function init(adminApp,storage) {
|
|||||||
adminApp.get("/nodes/:mod/:set",needsPermission("nodes.read"),nodes.getSet);
|
adminApp.get("/nodes/:mod/:set",needsPermission("nodes.read"),nodes.getSet);
|
||||||
adminApp.put("/nodes/:mod/:set",needsPermission("nodes.write"),nodes.putSet);
|
adminApp.put("/nodes/:mod/:set",needsPermission("nodes.write"),nodes.putSet);
|
||||||
|
|
||||||
adminApp.get(/^\/locales\/(.+?)\/(.*)$/,needsPermission("nodes.read"),locales.get);
|
adminApp.get(/^\/locales\/(.+?)\/(.*).json$/,needsPermission("nodes.read"),locales.get);
|
||||||
|
|
||||||
// Library
|
// Library
|
||||||
library.init(adminApp);
|
library.init(adminApp);
|
||||||
|
12
red/i18n.js
12
red/i18n.js
@ -22,9 +22,13 @@ var fs = require("fs");
|
|||||||
var defaultLang = "en-US";
|
var defaultLang = "en-US";
|
||||||
|
|
||||||
var resourceMap = {
|
var resourceMap = {
|
||||||
"messages": {
|
"runtime": {
|
||||||
basedir: path.resolve(__dirname+"/../locales"),
|
basedir: path.resolve(__dirname+"/../locales"),
|
||||||
file:"messages.json"
|
file:"runtime.json"
|
||||||
|
},
|
||||||
|
"editor": {
|
||||||
|
basedir: path.resolve(__dirname+"/../locales"),
|
||||||
|
file: "editor.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var resourceCache = {}
|
var resourceCache = {}
|
||||||
@ -69,8 +73,8 @@ function init() {
|
|||||||
i18n.backend(MessageFileLoader);
|
i18n.backend(MessageFileLoader);
|
||||||
i18n.init({
|
i18n.init({
|
||||||
ns: {
|
ns: {
|
||||||
namespaces: ["messages"],
|
namespaces: ["runtime","editor"],
|
||||||
defaultNs: "messages"
|
defaultNs: "runtime"
|
||||||
},
|
},
|
||||||
fallbackLng: ['en-US']
|
fallbackLng: ['en-US']
|
||||||
},function() {
|
},function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user