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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -76,7 +76,8 @@
outputs: 1, outputs: 1,
icon: "range.png", icon: "range.png",
label: function() { 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() { labelStyle: function() {
return this.name ? "node_label_italic" : ""; return this.name ? "node_label_italic" : "";

View File

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

View File

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

View File

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

View File

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