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
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":"";