1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Make core nodes labels more consistent, to close #1673

and make them translateable
This commit is contained in:
Dave Conway-Jones 2018-03-30 14:31:59 +01:00
parent acad9f57f9
commit 89bfc90f40
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
12 changed files with 35 additions and 17 deletions

View File

@ -138,7 +138,7 @@
icon: "arrow-in.png",
align: "right",
label: function() {
return this.name||this.command;
return this.name||this.command||(this.useSpawn=="true"?this._("exec.spawn"):this._("exec.exec"));
},
labelStyle: function() {
return this.name?"node_label_italic":"";

View File

@ -99,7 +99,7 @@
outputs:1,
icon: "template.png",
label: function() {
return this.name;
return this.name||this._("template.template");;
},
labelStyle: function() {
return this.name?"node_label_italic":"";

View File

@ -50,6 +50,7 @@ module.exports = function(RED) {
// try node context:
var dot = name.indexOf(".");
/* istanbul ignore else */
if (dot > 0) {
var contextName = name.substr(0, dot);
var variableName = name.substr(dot + 1);
@ -61,7 +62,8 @@ module.exports = function(RED) {
return this.nodeContext.global.get(variableName);
}
}
}catch(err) {
}
catch(err) {
throw err;
}
}
@ -103,9 +105,11 @@ module.exports = function(RED) {
} else {
value = template;
}
/* istanbul ignore else */
if (node.outputFormat === "json") {
value = JSON.parse(value);
}
/* istanbul ignore else */
if (node.outputFormat === "yaml") {
value = yaml.load(value);
}
@ -118,7 +122,8 @@ module.exports = function(RED) {
node.context().global.set(node.field,value);
}
node.send(msg);
} catch(err) {
}
catch(err) {
node.error(err.message);
}
});

View File

@ -33,7 +33,7 @@
outputs:0,
icon: "comment.png",
label: function() {
return this.name||"";
return this.name||this._("comment.comment");
},
labelStyle: function() {
return this.name?"node_label_italic":"";

View File

@ -59,7 +59,7 @@
outputs:1,
icon: "watch.png",
label: function() {
return this.name||this.files;
return this.name||this.files||this._("watch.watch");
},
labelStyle: function() {
return this.name?"node_label_italic":"";

View File

@ -70,8 +70,8 @@
}
},
"catch": {
"catch": "catch all",
"catchNodes": "catch (__number__)",
"catch": "catch: all",
"catchNodes": "catch: __number__",
"label": {
"source": "Catch errors from",
"node": "node",
@ -86,8 +86,8 @@
}
},
"status": {
"status": "status (all)",
"statusNodes": "status (__number__)",
"status": "status: all",
"statusNodes": "status: __number__",
"label": {
"source": "Report status from",
"node": "node",
@ -166,6 +166,8 @@
}
},
"exec": {
"exec": "exec",
"spawn": "spawn",
"label": {
"command": "Command",
"append": "Append",
@ -195,6 +197,7 @@
"tip": "See the Info tab for help writing functions."
},
"template": {
"template": "template",
"label": {
"template": "Template",
"property": "Set property",
@ -301,6 +304,7 @@
}
},
"comment": {
"comment": "comment",
"label": {
"title": "Title",
"body": "Body"
@ -416,6 +420,7 @@
}
},
"watch": {
"watch": "watch",
"label": {
"files": "File(s)",
"recursive": "Watch sub-directories recursively"
@ -542,6 +547,7 @@
}
},
"switch": {
"switch": "switch",
"label": {
"property": "Property",
"rule": "rule",
@ -597,6 +603,7 @@
}
},
"range": {
"range": "range",
"label": {
"action": "Action",
"inputrange": "Map the input range",
@ -784,6 +791,7 @@
}
},
"tail": {
"tail": "tail",
"label": {
"filename": "Filename",
"type": "File type",
@ -837,6 +845,7 @@
"tip": "Tip: The filename should be an absolute path, otherwise it will be relative to the working directory of the Node-RED process."
},
"split": {
"split": "split",
"intro":"Split <code>msg.payload</code> based on type:",
"object":"<b>Object</b>",
"objectSend":"Send a message for each key/value pair",
@ -848,6 +857,7 @@
"addname":" Copy key to "
},
"join":{
"join": "join",
"mode":{
"mode":"Mode",
"auto":"automatic",
@ -894,6 +904,7 @@
}
},
"sort" : {
"sort": "sort",
"target" : "Sort",
"seq" : "message sequence",
"key" : "Key",
@ -907,6 +918,7 @@
"clear" : "clear pending message in sort node"
},
"batch" : {
"batch": "batch",
"mode": {
"label" : "Mode",
"num-msgs" : "Group by number of messages",

View File

@ -140,7 +140,7 @@
},
icon: "switch.png",
label: function() {
return this.name||"switch";
return this.name||this._("swicth.switch");
},
labelStyle: function() {
return this.name?"node_label_italic":"";

View File

@ -76,7 +76,8 @@
outputs: 1,
icon: "range.png",
label: function() {
return this.name || "range";
if (this.minout !== "" && this.maxout !== "") { return this.name||this.minout + " - " + this.maxout; }
else { return this.name||this._("range.range"); }
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";

View File

@ -112,7 +112,7 @@
outputs:1,
icon: "split.png",
label: function() {
return this.name||"split";
return this.name||this._("split.split");
},
labelStyle: function() {
return this.name?"node_label_italic":"";
@ -367,7 +367,7 @@
outputs:1,
icon: "join.png",
label: function() {
return this.name||"join";
return this.name||this._("join.join");
},
labelStyle: function() {
return this.name?"node_label_italic":"";

View File

@ -103,7 +103,7 @@
outputs:1,
icon: "sort.png",
label: function() {
return this.name || "sort";
return this.name||this._("sort.sort");
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";

View File

@ -110,7 +110,7 @@
outputs:1,
icon: "batch.png",
label: function() {
return this.name || "batch";
return this.name||this._("batch.batch");;
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";

View File

@ -46,7 +46,7 @@
outputs:1,
icon: "file.png",
label: function() {
return this.name||this.filename||"tail";
return this.name||this.filename||this._("tail.tail");
},
labelStyle: function() {
return this.name?"node_label_italic":"";