Skip to content

Commit 89bfc90

Browse files
author
Dave Conway-Jones
committed
Make core nodes labels more consistent, to close node-red#1673
and make them translateable
1 parent acad9f5 commit 89bfc90

12 files changed

Lines changed: 35 additions & 17 deletions

File tree

nodes/core/core/75-exec.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ <h4>Killing processes</h4>
138138
icon: "arrow-in.png",
139139
align: "right",
140140
label: function() {
141-
return this.name||this.command;
141+
return this.name||this.command||(this.useSpawn=="true"?this._("exec.spawn"):this._("exec.exec"));
142142
},
143143
labelStyle: function() {
144144
return this.name?"node_label_italic":"";

nodes/core/core/80-template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ <h3>Details</h3>
9999
outputs:1,
100100
icon: "template.png",
101101
label: function() {
102-
return this.name;
102+
return this.name||this._("template.template");;
103103
},
104104
labelStyle: function() {
105105
return this.name?"node_label_italic":"";

nodes/core/core/80-template.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module.exports = function(RED) {
5050

5151
// try node context:
5252
var dot = name.indexOf(".");
53+
/* istanbul ignore else */
5354
if (dot > 0) {
5455
var contextName = name.substr(0, dot);
5556
var variableName = name.substr(dot + 1);
@@ -61,7 +62,8 @@ module.exports = function(RED) {
6162
return this.nodeContext.global.get(variableName);
6263
}
6364
}
64-
}catch(err) {
65+
}
66+
catch(err) {
6567
throw err;
6668
}
6769
}
@@ -103,9 +105,11 @@ module.exports = function(RED) {
103105
} else {
104106
value = template;
105107
}
108+
/* istanbul ignore else */
106109
if (node.outputFormat === "json") {
107110
value = JSON.parse(value);
108111
}
112+
/* istanbul ignore else */
109113
if (node.outputFormat === "yaml") {
110114
value = yaml.load(value);
111115
}
@@ -118,7 +122,8 @@ module.exports = function(RED) {
118122
node.context().global.set(node.field,value);
119123
}
120124
node.send(msg);
121-
} catch(err) {
125+
}
126+
catch(err) {
122127
node.error(err.message);
123128
}
124129
});

nodes/core/core/90-comment.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h3>Details</h3>
3333
outputs:0,
3434
icon: "comment.png",
3535
label: function() {
36-
return this.name||"";
36+
return this.name||this._("comment.comment");
3737
},
3838
labelStyle: function() {
3939
return this.name?"node_label_italic":"";

nodes/core/io/23-watch.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
outputs:1,
6060
icon: "watch.png",
6161
label: function() {
62-
return this.name||this.files;
62+
return this.name||this.files||this._("watch.watch");
6363
},
6464
labelStyle: function() {
6565
return this.name?"node_label_italic":"";

nodes/core/locales/en-US/messages.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
}
7171
},
7272
"catch": {
73-
"catch": "catch all",
74-
"catchNodes": "catch (__number__)",
73+
"catch": "catch: all",
74+
"catchNodes": "catch: __number__",
7575
"label": {
7676
"source": "Catch errors from",
7777
"node": "node",
@@ -86,8 +86,8 @@
8686
}
8787
},
8888
"status": {
89-
"status": "status (all)",
90-
"statusNodes": "status (__number__)",
89+
"status": "status: all",
90+
"statusNodes": "status: __number__",
9191
"label": {
9292
"source": "Report status from",
9393
"node": "node",
@@ -166,6 +166,8 @@
166166
}
167167
},
168168
"exec": {
169+
"exec": "exec",
170+
"spawn": "spawn",
169171
"label": {
170172
"command": "Command",
171173
"append": "Append",
@@ -195,6 +197,7 @@
195197
"tip": "See the Info tab for help writing functions."
196198
},
197199
"template": {
200+
"template": "template",
198201
"label": {
199202
"template": "Template",
200203
"property": "Set property",
@@ -301,6 +304,7 @@
301304
}
302305
},
303306
"comment": {
307+
"comment": "comment",
304308
"label": {
305309
"title": "Title",
306310
"body": "Body"
@@ -416,6 +420,7 @@
416420
}
417421
},
418422
"watch": {
423+
"watch": "watch",
419424
"label": {
420425
"files": "File(s)",
421426
"recursive": "Watch sub-directories recursively"
@@ -542,6 +547,7 @@
542547
}
543548
},
544549
"switch": {
550+
"switch": "switch",
545551
"label": {
546552
"property": "Property",
547553
"rule": "rule",
@@ -597,6 +603,7 @@
597603
}
598604
},
599605
"range": {
606+
"range": "range",
600607
"label": {
601608
"action": "Action",
602609
"inputrange": "Map the input range",
@@ -784,6 +791,7 @@
784791
}
785792
},
786793
"tail": {
794+
"tail": "tail",
787795
"label": {
788796
"filename": "Filename",
789797
"type": "File type",
@@ -837,6 +845,7 @@
837845
"tip": "Tip: The filename should be an absolute path, otherwise it will be relative to the working directory of the Node-RED process."
838846
},
839847
"split": {
848+
"split": "split",
840849
"intro":"Split <code>msg.payload</code> based on type:",
841850
"object":"<b>Object</b>",
842851
"objectSend":"Send a message for each key/value pair",
@@ -848,6 +857,7 @@
848857
"addname":" Copy key to "
849858
},
850859
"join":{
860+
"join": "join",
851861
"mode":{
852862
"mode":"Mode",
853863
"auto":"automatic",
@@ -894,6 +904,7 @@
894904
}
895905
},
896906
"sort" : {
907+
"sort": "sort",
897908
"target" : "Sort",
898909
"seq" : "message sequence",
899910
"key" : "Key",
@@ -907,6 +918,7 @@
907918
"clear" : "clear pending message in sort node"
908919
},
909920
"batch" : {
921+
"batch": "batch",
910922
"mode": {
911923
"label" : "Mode",
912924
"num-msgs" : "Group by number of messages",

nodes/core/logic/10-switch.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ <h4>Handling message sequences</h4>
140140
},
141141
icon: "switch.png",
142142
label: function() {
143-
return this.name||"switch";
143+
return this.name||this._("swicth.switch");
144144
},
145145
labelStyle: function() {
146146
return this.name?"node_label_italic":"";

nodes/core/logic/16-range.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ <h3>Details</h3>
7676
outputs: 1,
7777
icon: "range.png",
7878
label: function() {
79-
return this.name || "range";
79+
if (this.minout !== "" && this.maxout !== "") { return this.name||this.minout + " - " + this.maxout; }
80+
else { return this.name||this._("range.range"); }
8081
},
8182
labelStyle: function() {
8283
return this.name ? "node_label_italic" : "";

nodes/core/logic/17-split.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ <h4>Streaming mode</h4>
112112
outputs:1,
113113
icon: "split.png",
114114
label: function() {
115-
return this.name||"split";
115+
return this.name||this._("split.split");
116116
},
117117
labelStyle: function() {
118118
return this.name?"node_label_italic":"";
@@ -367,7 +367,7 @@ <h4>Storing messages</h4>
367367
outputs:1,
368368
icon: "join.png",
369369
label: function() {
370-
return this.name||"join";
370+
return this.name||this._("join.join");
371371
},
372372
labelStyle: function() {
373373
return this.name?"node_label_italic":"";

nodes/core/logic/18-sort.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
outputs:1,
104104
icon: "sort.png",
105105
label: function() {
106-
return this.name || "sort";
106+
return this.name||this._("sort.sort");
107107
},
108108
labelStyle: function() {
109109
return this.name ? "node_label_italic" : "";

0 commit comments

Comments
 (0)