mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Update locales module to new structure
This commit is contained in:
parent
1cdb039ea2
commit
825b0fb22f
@ -83,7 +83,7 @@ module.exports = {
|
||||
|
||||
// Locales
|
||||
var locales = require("./locales");
|
||||
locales.init(runtime);
|
||||
locales.init(runtimeAPI);
|
||||
editorApp.get('/locales/nodes',locales.getAllNodes,apiUtil.errorHandler);
|
||||
editorApp.get(/locales\/(.+)\/?$/,locales.get,apiUtil.errorHandler);
|
||||
|
||||
@ -124,6 +124,5 @@ module.exports = {
|
||||
});
|
||||
},
|
||||
stop: comms.stop,
|
||||
publish: comms.publish,
|
||||
registerLibrary: library.register
|
||||
publish: comms.publish
|
||||
}
|
||||
|
@ -16,13 +16,14 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
//var apiUtil = require('../util');
|
||||
var i18n;
|
||||
var redNodes;
|
||||
|
||||
var i18n = require("../../util").i18n; // TODO: separate module
|
||||
|
||||
var runtimeAPI;
|
||||
|
||||
module.exports = {
|
||||
init: function(runtime) {
|
||||
i18n = runtime.i18n;
|
||||
redNodes = runtime.nodes;
|
||||
init: function(_runtimeAPI) {
|
||||
runtimeAPI = _runtimeAPI;
|
||||
},
|
||||
get: function(req,res) {
|
||||
var namespace = req.params[0];
|
||||
@ -40,7 +41,10 @@ module.exports = {
|
||||
},
|
||||
getAllNodes: function(req,res) {
|
||||
var lngs = req.query.lng;
|
||||
var nodeList = redNodes.getNodeList();
|
||||
var opts = {
|
||||
user: req.user
|
||||
}
|
||||
runtimeAPI.nodes.getNodeList(opts).then(function(nodeList) {
|
||||
var result = {};
|
||||
nodeList.forEach(function(n) {
|
||||
if (n.module !== "node-red") {
|
||||
@ -48,5 +52,6 @@ module.exports = {
|
||||
}
|
||||
});
|
||||
res.json(result);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user