mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
add i18n support for port label of inject/exec/httprequest/file node
This commit is contained in:
@@ -172,17 +172,23 @@
|
||||
inputs:0,
|
||||
outputs:1,
|
||||
outputLabels: function(index) {
|
||||
var labels = { str:"string", num:"number", bool:"boolean", json:"object", flow:"flow context", global:"global context" };
|
||||
var lab = labels[this.payloadType] || this.payloadType;
|
||||
if (lab === "object") {
|
||||
var lab = this.payloadType;
|
||||
if (lab === "json") {
|
||||
try {
|
||||
lab = typeof JSON.parse(this.payload);
|
||||
if (lab === "object") {
|
||||
if (Array.isArray(JSON.parse(this.payload))) { lab = "Array"; }
|
||||
}
|
||||
} catch(e) { lab = "Invalid JSON Object"; }
|
||||
} catch(e) {
|
||||
return this._("inject.label.invalid"); }
|
||||
}
|
||||
return lab; },
|
||||
var name = "inject.label."+lab;
|
||||
var label = this._(name);
|
||||
if (name !== label) {
|
||||
return label;
|
||||
}
|
||||
return lab;
|
||||
},
|
||||
label: function() {
|
||||
var suffix = "";
|
||||
// if fire once then add small indication
|
||||
|
@@ -66,7 +66,13 @@
|
||||
},
|
||||
inputs:1,
|
||||
outputs:3,
|
||||
outputLabels: ["stdout","stderr","return code"],
|
||||
outputLabels: function(i) {
|
||||
return [
|
||||
this._("exec.label.stdout"),
|
||||
this._("exec.label.stderr"),
|
||||
this._("exec.label.retcode")
|
||||
][i];
|
||||
},
|
||||
icon: "arrow-in.png",
|
||||
align: "right",
|
||||
label: function() {
|
||||
|
@@ -102,7 +102,11 @@
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
outputLabels: function(i) {
|
||||
return ({txt:"UTF8 string", bin:"binary buffer", obj:"parsed JSON object"}[this.ret]);
|
||||
return ({
|
||||
txt: this._("httpin.label.utf8String"),
|
||||
bin: this._("httpin.label.binaryBuffer"),
|
||||
obj: this._("httpin.label.jsonObject")
|
||||
}[this.ret]);
|
||||
},
|
||||
icon: "white-globe.png",
|
||||
label: function() {
|
||||
|
@@ -100,7 +100,7 @@
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
outputLabels: function(i) {
|
||||
return (this.format === "utf8") ? "UTF8 string" : "binary buffer";
|
||||
return (this._((this.format === "utf8") ? "file.label.utf8String" : "file.label.binaryBuffer"));
|
||||
},
|
||||
icon: "file-in.png",
|
||||
label: function() {
|
||||
|
Reference in New Issue
Block a user