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

More node i18n tidy-up

This commit is contained in:
Nick O'Leary 2015-05-27 23:07:31 +01:00
parent 94e27dbfc5
commit 5522e57f65
19 changed files with 386 additions and 378 deletions

View File

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

View File

@ -109,16 +109,16 @@
if (this.pauseType == "delay") { if (this.pauseType == "delay") {
var units = this.timeoutUnits ? this.timeoutUnits.charAt(0) : "s"; var units = this.timeoutUnits ? this.timeoutUnits.charAt(0) : "s";
if (this.timeoutUnits == "milliseconds") { units = "ms"; } if (this.timeoutUnits == "milliseconds") { units = "ms"; }
return this.name||this._("delay.delaylabel")+" "+this.timeout+" " + units; return this.name||this._("delay.label.delay")+" "+this.timeout+" " + units;
} else if (this.pauseType == "rate") { } else if (this.pauseType == "rate") {
var units = this.rateUnits ? this.rateUnits.charAt(0) : "s"; var units = this.rateUnits ? this.rateUnits.charAt(0) : "s";
return this.name||this._("delay.limitlabel")+" "+this.rate+" "+this._("delay.msgperlabel")+ units; return this.name||this._("delay.label.limit")+" "+this.rate+" msg/"+ units;
} else if (this.pauseType == "random") { } else if (this.pauseType == "random") {
return this.name || this._("delay.randomlabel"); return this.name || this._("delay.label.random");
} }
else { else {
var units = this.rateUnits ? this.rateUnits.charAt(0) : "s"; var units = this.rateUnits ? this.rateUnits.charAt(0) : "s";
return this.name || this._("delay.queuelabel") +this.rate+" "+this._("delay.msgperlabel")+ units; return this.name || this._("delay.label.queue") +this.rate+" msg/"+ units;
} }
}, },
labelStyle: function() { // sets the class to apply to the label labelStyle: function() { // sets the class to apply to the label

View File

@ -104,7 +104,7 @@ module.exports = function(RED) {
node.status({text:node.buffer.length}); node.status({text:node.buffer.length});
} }
if (node.buffer.length > 1000) { if (node.buffer.length > 1000) {
node.warn(this.name + " " + RED._("delay.buffererr")); node.warn(this.name + " " + RED._("delay.error.buffer"));
} }
} else { } else {
node.send(msg); node.send(msg);

View File

@ -16,17 +16,17 @@
<script type="text/x-red" data-template-name="comment"> <script type="text/x-red" data-template-name="comment">
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-comment"></i> <span data-i18n="comment.title"></span></label> <label for="node-input-name"><i class="fa fa-comment"></i> <span data-i18n="comment.label.title"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]comment.comment"> <input type="text" id="node-input-name">
</div> </div>
<div class="form-row" style="margin-bottom: 0px;"> <div class="form-row" style="margin-bottom: 0px;">
<label for="node-input-info" style="width: 100% !important;"><i class="fa fa-comments"></i> <span data-i18n="comment.body"></span></label> <label for="node-input-info" style="width: 100% !important;"><i class="fa fa-comments"></i> <span data-i18n="comment.label.body"></span></label>
<input type="hidden" id="node-input-info" autofocus="autofocus"> <input type="hidden" id="node-input-info" autofocus="autofocus">
</div> </div>
<div class="form-row node-text-editor-row"> <div class="form-row node-text-editor-row">
<div style="height: 250px;" class="node-text-editor" id="node-input-info-editor" ></div> <div style="height: 250px;" class="node-text-editor" id="node-input-info-editor"></div>
</div> </div>
<div class="form-tips"><span data-i18n="comment.tip1"></span><i><a href="https://help.github.com/articles/markdown-basics/" target="_new"><span data-i18n="comment.tip2"></span></a></i></div> <div class="form-tips" data-i18n="[html]comment.tip"></div>
</script> </script>
<script type="text/x-red" data-help-name="comment"> <script type="text/x-red" data-help-name="comment">
@ -51,8 +51,8 @@
return this.name?"node_label_italic":""; return this.name?"node_label_italic":"";
}, },
info: function() { info: function() {
var t = this.name || this._("comment.commentnode"); var t = this.name || this._("comment.defaulttitle");
var b = this.info || this._("comment.commentinfo"); var b = this.info || this._("comment.defaultinfo");
return "### "+t+"\n"+b; return "### "+t+"\n"+b;
}, },
oneditprepare: function() { oneditprepare: function() {

View File

@ -39,7 +39,7 @@
outputs:1, outputs:1,
icon: "", icon: "",
label: function() { label: function() {
return "("+this.name+")"||this._("unknown.label.unknownlabel"); return "("+this.name+")"||this._("unknown.label.unknown");
}, },
labelStyle: function() { labelStyle: function() {
return "node_label_unknown"; return "node_label_unknown";

View File

@ -13,63 +13,6 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<script type="text/javascript">
function ws_oneditprepare() {
$("#websocket-client-row").hide();
$("#node-input-mode").change(function(){
if( $("#node-input-mode").val() === 'client') {
$("#websocket-server-row").hide();
$("#websocket-client-row").show();
}
else {
$("#websocket-server-row").show();
$("#websocket-client-row").hide();
}
});
if(this.client) {
$("#node-input-mode").val('client').change();
}
else {
$("#node-input-mode").val('server').change();
}
}
function ws_oneditsave() {
if($("#node-input-mode").val() === 'client') {
$("#node-input-server").append('<option value="">Dummy</option>');
$("#node-input-server").val('');
}
else {
$("#node-input-client").append('<option value="">Dummy</option>');
$("#node-input-client").val('');
}
}
function ws_label() {
var nodeid = (this.client)?this.client:this.server;
var wsNode = RED.nodes.node(nodeid);
return this.name||(wsNode?"[ws] "+wsNode.label():"websocket");
}
function ws_validateserver() {
if($("#node-input-mode").val() === 'client' || (this.client && !this.server)) {
return true;
}
else {
return RED.nodes.node(this.server) != null;
}
}
function ws_validateclient() {
if($("#node-input-mode").val() === 'client' || (this.client && !this.server)) {
return RED.nodes.node(this.client) != null;
}
else {
return true;
}
}
</script>
<!-- WebSocket Input Node --> <!-- WebSocket Input Node -->
<script type="text/x-red" data-template-name="websocket in"> <script type="text/x-red" data-template-name="websocket in">
<div class="form-row"> <div class="form-row">
@ -101,6 +44,65 @@ function ws_validateclient() {
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
(function() {
function ws_oneditprepare() {
$("#websocket-client-row").hide();
$("#node-input-mode").change(function(){
if( $("#node-input-mode").val() === 'client') {
$("#websocket-server-row").hide();
$("#websocket-client-row").show();
}
else {
$("#websocket-server-row").show();
$("#websocket-client-row").hide();
}
});
if(this.client) {
$("#node-input-mode").val('client').change();
}
else {
$("#node-input-mode").val('server').change();
}
}
function ws_oneditsave() {
if($("#node-input-mode").val() === 'client') {
$("#node-input-server").append('<option value="">Dummy</option>');
$("#node-input-server").val('');
}
else {
$("#node-input-client").append('<option value="">Dummy</option>');
$("#node-input-client").val('');
}
}
function ws_label() {
var nodeid = (this.client)?this.client:this.server;
var wsNode = RED.nodes.node(nodeid);
return this.name||(wsNode?"[ws] "+wsNode.label():"websocket");
}
function ws_validateserver() {
if($("#node-input-mode").val() === 'client' || (this.client && !this.server)) {
return true;
}
else {
return RED.nodes.node(this.server) != null;
}
}
function ws_validateclient() {
if($("#node-input-mode").val() === 'client' || (this.client && !this.server)) {
return RED.nodes.node(this.client) != null;
}
else {
return true;
}
}
RED.nodes.registerType('websocket in',{ RED.nodes.registerType('websocket in',{
category: 'input', category: 'input',
defaults: { defaults: {
@ -119,6 +121,75 @@ function ws_validateclient() {
oneditsave: ws_oneditsave, oneditsave: ws_oneditsave,
oneditprepare: ws_oneditprepare oneditprepare: ws_oneditprepare
}); });
RED.nodes.registerType('websocket out',{
category: 'output',
defaults: {
name: {value:""},
server: {type:"websocket-listener", validate: ws_validateserver},
client: {type:"websocket-client", validate: ws_validateclient}
},
color:"rgb(215, 215, 160)",
inputs:1,
outputs:0,
icon: "white-globe.png",
align: "right",
labelStyle: function() {
return this.name?"node_label_italic":"";
},
label: ws_label,
oneditsave: ws_oneditsave,
oneditprepare: ws_oneditprepare
});
RED.nodes.registerType('websocket-listener',{
category: 'config',
defaults: {
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/) },
wholemsg: {value:"false"}
},
inputs:0,
outputs:0,
label: function() {
var root = RED.settings.httpNodeRoot;
if (root.slice(-1) != "/") {
root = root+"/";
}
if (this.path.charAt(0) == "/") {
root += this.path.slice(1);
} else {
root += this.path;
}
return root;
},
oneditprepare: function() {
var root = RED.settings.httpNodeRoot;
if (root.slice(-1) == "/") {
root = root.slice(0,-1);
}
if (root == "") {
$("#node-config-ws-tip").hide();
} else {
$("#node-config-ws-path").html(root);
$("#node-config-ws-tip").show();
}
}
});
RED.nodes.registerType('websocket-client',{
category: 'config',
defaults: {
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/) },
wholemsg: {value:"false"}
},
inputs:0,
outputs:0,
label: function() {
return this.path;
}
});
})();
</script> </script>
<!-- WebSocket out Node --> <!-- WebSocket out Node -->
@ -157,28 +228,6 @@ function ws_validateclient() {
should delete the <b>msg._session</b> property within the flow</p>. should delete the <b>msg._session</b> property within the flow</p>.
</script> </script>
<script type="text/javascript">
RED.nodes.registerType('websocket out',{
category: 'output',
defaults: {
name: {value:""},
server: {type:"websocket-listener", validate: ws_validateserver},
client: {type:"websocket-client", validate: ws_validateclient}
},
color:"rgb(215, 215, 160)",
inputs:1,
outputs:0,
icon: "white-globe.png",
align: "right",
labelStyle: function() {
return this.name?"node_label_italic":"";
},
label: ws_label,
oneditsave: ws_oneditsave,
oneditprepare: ws_oneditprepare
});
</script>
<!-- WebSocket Server configuration node --> <!-- WebSocket Server configuration node -->
<script type="text/x-red" data-template-name="websocket-listener"> <script type="text/x-red" data-template-name="websocket-listener">
<div class="form-row"> <div class="form-row">
@ -202,42 +251,6 @@ function ws_validateclient() {
<p>This configuration node creates a WebSocket Server using the specified path</p> <p>This configuration node creates a WebSocket Server using the specified path</p>
</script> </script>
<script type="text/javascript">
RED.nodes.registerType('websocket-listener',{
category: 'config',
defaults: {
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/) },
wholemsg: {value:"false"}
},
inputs:0,
outputs:0,
label: function() {
var root = RED.settings.httpNodeRoot;
if (root.slice(-1) != "/") {
root = root+"/";
}
if (this.path.charAt(0) == "/") {
root += this.path.slice(1);
} else {
root += this.path;
}
return root;
},
oneditprepare: function() {
var root = RED.settings.httpNodeRoot;
if (root.slice(-1) == "/") {
root = root.slice(0,-1);
}
if (root == "") {
$("#node-config-ws-tip").hide();
} else {
$("#node-config-ws-path").html(root);
$("#node-config-ws-tip").show();
}
}
});
</script>
<!-- WebSocket Client configuration node --> <!-- WebSocket Client configuration node -->
<script type="text/x-red" data-template-name="websocket-client"> <script type="text/x-red" data-template-name="websocket-client">
<div class="form-row"> <div class="form-row">
@ -261,17 +274,3 @@ function ws_validateclient() {
<p>This configuration node connects a WebSocket client to the specified URL.</p> <p>This configuration node connects a WebSocket client to the specified URL.</p>
</script> </script>
<script type="text/javascript">
RED.nodes.registerType('websocket-client',{
category: 'config',
defaults: {
path: {value:"",required:true,validate:RED.validators.regex(/^((?!\/debug\/ws).)*$/) },
wholemsg: {value:"false"}
},
inputs:0,
outputs:0,
label: function() {
return this.path;
}
});
</script>

View File

@ -17,7 +17,7 @@
<script type="text/x-red" data-template-name="watch"> <script type="text/x-red" data-template-name="watch">
<div class="form-row node-input-filename"> <div class="form-row node-input-filename">
<label for="node-input-files"><i class="fa fa-file"></i> <span data-i18n="watch.label.files"></span></label> <label for="node-input-files"><i class="fa fa-file"></i> <span data-i18n="watch.label.files"></span></label>
<input type="text" id="node-input-files" data-i18n="[placeholder]watch.label.filesph"> <input type="text" id="node-input-files" data-i18n="[placeholder]watch.placeholder.files">
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label> <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>

View File

@ -18,8 +18,8 @@
<div class="form-row"> <div class="form-row">
<label for="node-input-server"><i class="fa fa-dot-circle-o"></i> <span data-i18n="tcpin.label.type"></span></label> <label for="node-input-server"><i class="fa fa-dot-circle-o"></i> <span data-i18n="tcpin.label.type"></span></label>
<select id="node-input-server" style="width:120px; margin-right:5px;"> <select id="node-input-server" style="width:120px; margin-right:5px;">
<option value="server" data-i18n="tcpin.listen"></option> <option value="server" data-i18n="tcpin.type.listen"></option>
<option value="client" data-i18n="tcpin.connect"></option> <option value="client" data-i18n="tcpin.type.connect"></option>
</select> </select>
<span data-i18n="tcpin.label.port"></span> <input type="text" id="node-input-port" style="width: 50px"> <span data-i18n="tcpin.label.port"></span> <input type="text" id="node-input-port" style="width: 50px">
</div> </div>
@ -29,15 +29,14 @@
<div class="form-row"> <div class="form-row">
<label><i class="fa fa-sign-out"></i> <span data-i18n="tcpin.label.output"></span></label> <label><i class="fa fa-sign-out"></i> <span data-i18n="tcpin.label.output"></span></label>
<span data-i18n="tcpin.label.a"></span>
<select id="node-input-datamode" style="width:110px;"> <select id="node-input-datamode" style="width:110px;">
<option value="stream" data-i18n="tcpin.stream"></option> <option value="stream" data-i18n="tcpin.output.stream"></option>
<option value="single" data-i18n="tcpin.single"></option> <option value="single" data-i18n="tcpin.output.single"></option>
</select> </select>
<select id="node-input-datatype" style="width:140px;"> <select id="node-input-datatype" style="width:140px;">
<option value="buffer" data-i18n="tcpin.buffer"></option> <option value="buffer" data-i18n="tcpin.output.buffer"></option>
<option value="utf8" data-i18n="tcpin.string"></option> <option value="utf8" data-i18n="tcpin.output.string"></option>
<option value="base64" data-i18n="tcpin.base64"></option> <option value="base64" data-i18n="tcpin.output.base64"></option>
</select> </select>
<span data-i18n="tcpin.label.payload"></span> <span data-i18n="tcpin.label.payload"></span>
</div> </div>
@ -118,15 +117,15 @@
<div class="form-row"> <div class="form-row">
<label for="node-input-beserver"><i class="fa fa-dot-circle-o"></i> <span data-i18n="tcpin.label.type"></span></label> <label for="node-input-beserver"><i class="fa fa-dot-circle-o"></i> <span data-i18n="tcpin.label.type"></span></label>
<select id="node-input-beserver" style="width:150px; margin-right:5px;"> <select id="node-input-beserver" style="width:150px; margin-right:5px;">
<option value="server" data-i18n="tcpin.listen"></option> <option value="server" data-i18n="tcpin.type.listen"></option>
<option value="client" data-i18n="tcpin.connect"></option> <option value="client" data-i18n="tcpin.type.connect"></option>
<option value="reply" data-i18n="tcpin.reply"></option> <option value="reply" data-i18n="tcpin.type.reply"></option>
</select> </select>
<span id="node-input-port-row"><span data-i18n="tcpin.label.port"></span> <input type="text" id="node-input-port" style="width: 50px"></span> <span id="node-input-port-row"><span data-i18n="tcpin.label.port"></span> <input type="text" id="node-input-port" style="width: 50px"></span>
</div> </div>
<div class="form-row hidden" id="node-input-host-row" style="padding-left: 110px;"> <div class="form-row hidden" id="node-input-host-row" style="padding-left: 110px;">
<span data-i18n="tcpin.label.host"></span> <input type="text" id="node-input-host" placeholder="localhost" style="width: 60%;"> <span data-i18n="tcpin.label.host"></span> <input type="text" id="node-input-host" style="width: 60%;">
</div> </div>
<div class="form-row hidden" id="node-input-end-row"> <div class="form-row hidden" id="node-input-end-row">
@ -145,13 +144,6 @@
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label> <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name"> <input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div> </div>
<div class="form-tips hidden" id="fin-tip">
<span data-i18n="[html]tcpin.out-tip1"></span>
</div>
<div class="form-tips hidden" id="fin-tip2">
<span data-i18n="[html]tcpin.out-tip2"></span>
</div>
</script> </script>
<script type="text/x-red" data-help-name="tcp out"> <script type="text/x-red" data-help-name="tcp out">
@ -199,17 +191,8 @@
if (sockettype == "client") { if (sockettype == "client") {
$("#node-input-host-row").show(); $("#node-input-host-row").show();
$("#fin-tip").show();
} else { } else {
$("#node-input-host-row").hide(); $("#node-input-host-row").hide();
$("#fin-tip").hide();
}
if (sockettype == "server") {
$("#fin-tip2").show();
}
else {
$("#fin-tip2").hide();
} }
}; };
updateOptions(); updateOptions();
@ -223,15 +206,15 @@
<div class="form-row"> <div class="form-row">
<label for="node-input-server"><i class="fa fa-globe"></i> <span data-i18n="tcpin.label.server"></span></label> <label for="node-input-server"><i class="fa fa-globe"></i> <span data-i18n="tcpin.label.server"></span></label>
<input type="text" id="node-input-server" placeholder="ip.address" style="width:45%"> <input type="text" id="node-input-server" placeholder="ip.address" style="width:45%">
&nbsp;port <input type="text" id="node-input-port" data-i18n="[placeholder]tcpin.label.numberph" style="width:60px"> &nbsp;port <input type="text" id="node-input-port" style="width:60px">
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-input-out"><i class="fa fa-sign-out"></i> <span data-i18n="tcpin.label.return"></span></label> <label for="node-input-out"><i class="fa fa-sign-out"></i> <span data-i18n="tcpin.label.return"></span></label>
<select type="text" id="node-input-out" style="width:56%;"> <select type="text" id="node-input-out" style="width:56%;">
<option value="time" data-i18n="tcpin.timeout"></option> <option value="time" data-i18n="tcpin.return.timeout"></option>
<option value="char" data-i18n="tcpin.character"></option> <option value="char" data-i18n="tcpin.return.character"></option>
<option value="count" data-i18n="tcpin.number"></option> <option value="count" data-i18n="tcpin.return.number"></option>
<option value="sit" data-i18n="tcpin.never"></option> <option value="sit" data-i18n="tcpin.return.never"></option>
</select> </select>
<input type="text" id="node-input-splitc" style="width:50px;"> <input type="text" id="node-input-splitc" style="width:50px;">
<span id="node-units"></span> <span id="node-units"></span>
@ -240,7 +223,6 @@
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label> <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name"> <input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div> </div>
<div class="form-tips"><span data-i18n="[html]tcpin.req-tip"></span></div>
<script> <script>
var previous = null; var previous = null;
$("#node-input-out").on('focus', function () { previous = this.value; }).change(function() { $("#node-input-out").on('focus', function () { previous = this.value; }).change(function() {

View File

@ -43,13 +43,13 @@ module.exports = function(RED) {
var reconnectTimeout; var reconnectTimeout;
var end = false; var end = false;
var setupTcpClient = function() { var setupTcpClient = function() {
node.log(RED._("tcpin.errors.connecting-to")+" "+node.host+":"+node.port); node.log(RED._("tcpin.status.connecting",{host:node.host,port:node.port}));
node.status({fill:"grey",shape:"dot",text:RED._("common.status.connecting")}); node.status({fill:"grey",shape:"dot",text:RED._("common.status.connecting")});
var id = (1+Math.random()*4294967295).toString(16); var id = (1+Math.random()*4294967295).toString(16);
client = net.connect(node.port, node.host, function() { client = net.connect(node.port, node.host, function() {
buffer = (node.datatype == 'buffer')? new Buffer(0):""; buffer = (node.datatype == 'buffer')? new Buffer(0):"";
node.connected = true; node.connected = true;
node.log(RED._("tcpin.errors.connected-to")+" "+node.host+":"+node.port); node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port}));
node.status({fill:"green",shape:"dot",text:RED._("common.status.connected")}); node.status({fill:"green",shape:"dot",text:RED._("common.status.connected")});
}); });
connectionPool[id] = client; connectionPool[id] = client;
@ -103,7 +103,7 @@ module.exports = function(RED) {
reconnectTimeout = setTimeout(setupTcpClient, 20); reconnectTimeout = setTimeout(setupTcpClient, 20);
} }
else { else {
node.log(RED._("tcpin.errors.connection-lost")+" "+node.host+":"+node.port); node.log(RED._("tcpin.errors.connection-lost",{host:node.host,port:node.port}));
reconnectTimeout = setTimeout(setupTcpClient, reconnectTime); reconnectTimeout = setTimeout(setupTcpClient, reconnectTime);
} }
} else { } else {
@ -170,7 +170,7 @@ module.exports = function(RED) {
} }
}); });
socket.on('timeout', function() { socket.on('timeout', function() {
node.log(RED._("tcpin.errors.timeout")+' '+node.port); node.log(RED._("tcpin.errors.timeout",{port:node.port}));
socket.end(); socket.end();
}); });
socket.on('close', function() { socket.on('close', function() {
@ -183,15 +183,15 @@ module.exports = function(RED) {
}); });
server.on('error', function(err) { server.on('error', function(err) {
if (err) { if (err) {
node.error(RED._("tcpin.errors.cannot-listen")+' '+node.port+' : '+err); node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err}));
} }
}); });
server.listen(node.port, function(err) { server.listen(node.port, function(err) {
if (err) { if (err) {
node.error(RED._("tcpin.errors.cannot-listen")+' '+node.port+' : '+err); node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err}));
} else { } else {
node.log(RED._("tcpin.errors.listening-port")+' '+node.port); node.log(RED._("tcpin.status.listening-port",{port:node.port}));
node.on('close', function() { node.on('close', function() {
for (var c in connectionPool) { for (var c in connectionPool) {
if (connectionPool.hasOwnProperty(c)) { if (connectionPool.hasOwnProperty(c)) {
@ -201,7 +201,7 @@ module.exports = function(RED) {
} }
node.closing = true; node.closing = true;
server.close(); server.close();
node.log(RED._("tcpin.errors.stopped-listening")+' '+node.port); node.log(RED._("tcpin.status.stopped-listening",{port:node.port}));
}); });
} }
}); });
@ -228,15 +228,15 @@ module.exports = function(RED) {
var end = false; var end = false;
var setupTcpClient = function() { var setupTcpClient = function() {
node.log(RED._("tcpin.errors.connecting-to")+" "+node.host+":"+node.port); node.log(RED._("tcpin.status.connecting",{host:node.host,port:node.port}));
node.status({fill:"grey",shape:"dot",text:RED._("common.status.connecting")}); node.status({fill:"grey",shape:"dot",text:RED._("common.status.connecting")});
client = net.connect(node.port, node.host, function() { client = net.connect(node.port, node.host, function() {
node.connected = true; node.connected = true;
node.log(RED._("tcpin.errors.connected-to")+" "+node.host+":"+node.port); node.log(RED._("tcpin.status.connected",{host:node.host,port:node.port}));
node.status({fill:"green",shape:"dot",text:RED._("common.status.connected")}); node.status({fill:"green",shape:"dot",text:RED._("common.status.connected")});
}); });
client.on('error', function (err) { client.on('error', function (err) {
node.log(RED._("tcpin.errors.error")+' : '+err); node.log(RED._("tcpin.errors.error",{error:err}));
}); });
client.on('end', function (err) { client.on('end', function (err) {
}); });
@ -250,7 +250,7 @@ module.exports = function(RED) {
reconnectTimeout = setTimeout(setupTcpClient,20); reconnectTimeout = setTimeout(setupTcpClient,20);
} }
else { else {
node.log(RED._("tcpin.errors.connection-lost")+" "+node.host+":"+node.port); node.log(RED._("tcpin.errors.connection-lost",{host:node.host,port:node.port}));
reconnectTimeout = setTimeout(setupTcpClient,reconnectTime); reconnectTimeout = setTimeout(setupTcpClient,reconnectTime);
} }
} else { } else {
@ -305,20 +305,20 @@ module.exports = function(RED) {
var server = net.createServer(function (socket) { var server = net.createServer(function (socket) {
if (socketTimeout !== null) { socket.setTimeout(socketTimeout); } if (socketTimeout !== null) { socket.setTimeout(socketTimeout); }
var remoteDetails = socket.remoteAddress+":"+socket.remotePort; var remoteDetails = socket.remoteAddress+":"+socket.remotePort;
node.log(RED._("tcpin.errors.connection-from")+" "+remoteDetails); node.log(RED._("tcpin.status.connection-from",{host:socket.remoteAddress, port:socket.remotePort}));
connectedSockets.push(socket); connectedSockets.push(socket);
node.status({text:connectedSockets.length+" "+RED._("common.status.connections")}); node.status({text:connectedSockets.length+" "+RED._("common.status.connections")});
socket.on('timeout', function() { socket.on('timeout', function() {
node.log(RED._("tcpin.errors.timeout")+' '+node.port); node.log(RED._("tcpin.errors.timeout",{port:node.port}));
socket.end(); socket.end();
}); });
socket.on('close',function() { socket.on('close',function() {
node.log(RED._("tcpin.errors.connection-closed")+" "+remoteDetails); node.log(RED._("tcpin.status.connection-closed",{host:socket.remoteAddress, port:socket.remotePort}));
connectedSockets.splice(connectedSockets.indexOf(socket),1); connectedSockets.splice(connectedSockets.indexOf(socket),1);
node.status({text:connectedSockets.length+" "+RED._("common.status.connections")}); node.status({text:connectedSockets.length+" "+RED._("common.status.connections")});
}); });
socket.on('error',function() { socket.on('error',function() {
node.log(RED._("tcpin.errors.socket-error")+" "+remoteDetails); node.log(RED._("tcpin.errors.socket-error",{host:socket.remoteAddress, port:socket.remotePort}));
connectedSockets.splice(connectedSockets.indexOf(socket),1); connectedSockets.splice(connectedSockets.indexOf(socket),1);
node.status({text:connectedSockets.length+" "+RED._("common.status.connections")}); node.status({text:connectedSockets.length+" "+RED._("common.status.connections")});
}); });
@ -343,15 +343,15 @@ module.exports = function(RED) {
server.on('error', function(err) { server.on('error', function(err) {
if (err) { if (err) {
node.error(RED._("tcpin.errors.cannot-listen")+' '+node.port+' : '+err); node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err}));
} }
}); });
server.listen(node.port, function(err) { server.listen(node.port, function(err) {
if (err) { if (err) {
node.error(RED._("tcpin.errors.cannot-listen")+' '+node.port+' : '+err); node.error(RED._("tcpin.errors.cannot-listen",{port:node.port,error:err}));
} else { } else {
node.log(RED._("tcpin.errors.listening-port")+' '+node.port); node.log(RED._("tcpin.status.listening-port",{port:node.port}));
node.on('close', function() { node.on('close', function() {
for (var c in connectedSockets) { for (var c in connectedSockets) {
if (connectedSockets.hasOwnProperty(c)) { if (connectedSockets.hasOwnProperty(c)) {
@ -360,7 +360,7 @@ module.exports = function(RED) {
} }
} }
server.close(); server.close();
node.log(RED._("tcpin.errors.stopped-listening")+' '+node.port); node.log(RED._("tcpin.status.stopped-listening",{port:node.port}));
}); });
} }
}); });
@ -482,7 +482,7 @@ module.exports = function(RED) {
}); });
client.on('timeout',function() { client.on('timeout',function() {
node.warn(RED._("tcpin.errors.timeout")); node.warn(RED._("tcpin.errors.connect-timeout"));
if (client) { if (client) {
client.end(); client.end();
setTimeout(function() { setTimeout(function() {

View File

@ -79,7 +79,6 @@
"onstart": "Inject once at start?", "onstart": "Inject once at start?",
"tip": "<b>Note:</b> \"interval between times\" and \"at a specific time\" will use cron.<br/>See info box for details.", "tip": "<b>Note:</b> \"interval between times\" and \"at a specific time\" will use cron.<br/>See info box for details.",
"success": "Successfully injected: __label__", "success": "Successfully injected: __label__",
"error": "<strong>Error</strong>: __message__",
"errors": { "errors": {
"failed": "inject failed, see log for details" "failed": "inject failed, see log for details"
} }
@ -110,7 +109,7 @@
"placeholder": { "placeholder": {
"extraparams": "extra input parameters" "extraparams": "extra input parameters"
}, },
"spawn": "Use spawn() instead of exec() ?", "spawn": "Use spawn() instead of exec()?",
"tip": "Tip: <i>spawn</i> expects only one command word - and appended args to be comma separated." "tip": "Tip: <i>spawn</i> expects only one command word - and appended args to be comma separated."
}, },
"function": { "function": {
@ -148,15 +147,17 @@
"rate": "Rate", "rate": "Rate",
"msgper": "msg(s) per", "msgper": "msg(s) per",
"dropmsg": "drop intermediate messages", "dropmsg": "drop intermediate messages",
"delaylabel": "delay", "label": {
"delay": "delay",
"limitlabel": "limit", "limitlabel": "limit",
"randomlabel": "ramdom", "randomlabel": "ramdom",
"queuelabel": "queue", "queuelabel": "queue"
"msgperlabel": "msg/", },
"buffererr": "buffer exceeded 1000 messages" "error": {
"buffer": "buffer exceeded 1000 messages"
}
}, },
"trigger": { "trigger": {
"trigger": "trigger",
"output1": "Output", "output1": "Output",
"wait": "then wait", "wait": "then wait",
"output2": "output", "output2": "output",
@ -175,18 +176,17 @@
"triggeroncelabel": "trigger once & infinite" "triggeroncelabel": "trigger once & infinite"
}, },
"comment": { "comment": {
"comment": "comment", "label": {
"title": "Title", "title": "Title",
"body": "Body - will be rendered in info tab.", "body": "Body"
"tip1": "Tip: The text here can be styled as ", },
"tip2": "Github flavoured Markdown", "tip": "Tip: The text can be styled as <a href=\"https://help.github.com/articles/markdown-basics/\" target=\"_new\">Github flavoured Markdown</a>",
"commentnode": "Comment node", "defaulttitle": "Comment node",
"commentinfo": "Use this node to add simple documentation.\n\nAnything you add will be rendered in this info panel.\n\nYou may use Markdown syntax to **enhance** the *presentation*." "defaultinfo": "Use this node to add simple documentation.\n\nAnything you add will be rendered in this info panel.\n\nYou may use Markdown syntax to **enhance** the *presentation*."
}, },
"unknown": { "unknown": {
"unknown": "unknown",
"label": { "label": {
"unknownlabel": "unknown" "unknown": "unknown"
}, },
"tip": "<p>This node is a type unknown to your installation of Node-RED.</p><p><i>If you deploy with the node in this state, it's configuration will be preserved, but the flow will not start until the missing type is installed.</i></p><p>See the Info side bar for more help</p>" "tip": "<p>This node is a type unknown to your installation of Node-RED.</p><p><i>If you deploy with the node in this state, it's configuration will be preserved, but the flow will not start until the missing type is installed.</i></p><p>See the Info side bar for more help</p>"
}, },
@ -219,7 +219,7 @@
"return": "Return" "return": "Return"
}, },
"setby": "- set by msg.method -", "setby": "- set by msg.method -",
"basicauth": "Use basic authentication ?", "basicauth": "Use basic authentication?",
"utf8": "a UTF-8 string", "utf8": "a UTF-8 string",
"binary": "a binary buffer", "binary": "a binary buffer",
"json": "a parsed JSON object", "json": "a parsed JSON object",
@ -238,7 +238,6 @@
} }
}, },
"websocket": { "websocket": {
"websocket": "websocket",
"label": { "label": {
"type": "Type", "type": "Type",
"path": "Path", "path": "Path",
@ -261,18 +260,17 @@
} }
}, },
"watch": { "watch": {
"watch": "watch",
"label": { "label": {
"files": "File(s)", "files": "File(s)"
"filesph": "File(s) or Directory" },
"placeholder": {
"files": "Comma-separated list of files and/or directories"
}, },
"tip": "On Windows you must use double back-slashes \\\\ in any directory names." "tip": "On Windows you must use double back-slashes \\\\ in any directory names."
}, },
"serial": { "serial": {
"serial": "serial",
"label": { "label": {
"serialport": "Serial Port", "serialport": "Serial Port",
"serialportph": "/dev/ttyUSB0/",
"settings": "Settings", "settings": "Settings",
"baudrate": "Baud Rate", "baudrate": "Baud Rate",
"databits": "Data Bits", "databits": "Data Bits",
@ -285,29 +283,38 @@
"serial": "serial", "serial": "serial",
"none": "none" "none": "none"
}, },
"placeholder": {
"serialport": "for example: /dev/ttyUSB0/"
},
"parity": {
"none": "None", "none": "None",
"even": "Even", "even": "Even",
"mark": "Mark", "mark": "Mark",
"odd": "Odd", "odd": "Odd",
"space": "Space", "space": "Space"
},
"split": {
"character": "on the character", "character": "on the character",
"timeout": "after a timeout of", "timeout": "after a timeout of",
"length": "into fixed lengths of", "length": "into fixed lengths of"
},
"output": {
"ascii": "ascii strings", "ascii": "ascii strings",
"binary": "binary buffers", "binary": "binary buffers"
},
"addsplit": "add split character to output messages", "addsplit": "add split character to output messages",
"split-tip": "Tip: the \"Split on\" character is used to split the input into separate messages. It can also be added to every message sent out to the serial port.", "tip": {
"timeout-tip": "Tip: In timeout mode timeout starts from arrival of first character.", "split": "Tip: the \"Split on\" character is used to split the input into separate messages. It can also be added to every message sent out to the serial port.",
"timeout": "Tip: In timeout mode timeout starts from arrival of first character."
},
"onopen": "serial port __port__ opened at __baud__ baud __config__",
"errors": { "errors": {
"missing-conf": "missing serial config", "missing-conf": "missing serial config",
"never-get": "should never get here",
"serial-port": "serial port", "serial-port": "serial port",
"error": "error", "error": "serial port __port__ error: __error__",
"unexpected-close": "closed unexpectedly", "unexpected-close": "serial port __port__ closed unexpectedly",
"opened": "opened at", "disconnected": "serial port __port__ disconnected",
"baud": "baud", "closed": "serial port __port__ closed"
"gone-away": "gone away",
"closed": "closed"
} }
}, },
"tcpin": { "tcpin": {
@ -317,52 +324,52 @@
"output": "Output", "output": "Output",
"port": "port", "port": "port",
"host": "at host", "host": "at host",
"a": "a",
"payload": "payload(s)", "payload": "payload(s)",
"delimited": "delimited by", "delimited": "delimited by",
"close-connection": "Close connection after each message is sent ?", "close-connection": "Close connection after each message is sent?",
"decode-base64": "Decode Base64 message ?", "decode-base64": "Decode Base64 message?",
"server": "Server", "server": "Server",
"return": "Return", "return": "Return"
"numberph": "number"
}, },
"type": {
"listen": "Listen on", "listen": "Listen on",
"connect": "Connect to", "connect": "Connect to",
"reply": "Reply to TCP", "reply": "Reply to TCP"
},
"output": {
"stream": "stream of", "stream": "stream of",
"single": "single", "single": "single",
"buffer": "Buffer", "buffer": "Buffer",
"string": "String", "string": "String",
"base64": "Base64 String", "base64": "Base64 String"
},
"return": {
"timeout": "after a fixed timeout of", "timeout": "after a fixed timeout of",
"character": "when character received is", "character": "when character received is",
"number": "a fixed number of characters", "number": "a fixed number of chars:",
"never": "never. Keep connection open", "never": "keep connection open"
"out-tip1": "Closing the connection after each message is generally not a good thing - but is useful to indicate an end-of-file for example.", },
"out-tip2": "Closing the connection after each message is generally not a good thing - but is useful to indicate an end-of-file for example. The receiving client will need to reconnect.", "status": {
"req-tip": "<b>Tip:</b> Outputs a binary <b>Buffer</b>, so you may want to .toString() it.</br/><b>Tip:</b> Leave host and port blank if you want to overide with msg.host and msg.port properties.", "connecting": "connecting to __host__:__port__",
"errors": { "connected": "connected to __host__:__port__",
"connecting-to": "connecting to", "listening-port": "listening on port __port__",
"connected-to": "connected to",
"connection-lost": "connection lost to",
"timeout": "timeout closed socket port",
"listening-port": "listening on port",
"stopped-listening": "stopped listening on port", "stopped-listening": "stopped listening on port",
"error": "error", "connection-from": "connection from __host__:__port__",
"connection-from": "connection from", "connection-closed": "connection closed from __host__:__port__"
"connection-closed": "connection closed from", },
"socket-error": "socket error from", "errors": {
"client-connected": "client connected", "connection-lost": "connection lost to __host__:__port__",
"data": "data:", "timeout": "timeout closed socket port __port__",
"client-disconnected": "client disconnected", "cannot-listen": "unable to listen on port __port__, error: __error__",
"error": "error: __error__",
"socket-error": "socket error from __host__:__port__",
"no-host": "Host and/or port not set", "no-host": "Host and/or port not set",
"timeout": "connect timeout", "connect-timeout": "connect timeout",
"cannot-listen": "unable to listen on port",
"connect-fail": "connect failed" "connect-fail": "connect failed"
} }
}, },
"udp": { "udp": {
"udp": "udp",
"label": { "label": {
"listen": "Listen for", "listen": "Listen for",
"onport": "on Port", "onport": "on Port",
@ -377,7 +384,7 @@
"toportph": "port", "toportph": "port",
"address": "Address", "address": "Address",
"addressph": "destination ip", "addressph": "destination ip",
"decode-base64": "Decode Base64 encoded payload ?", "decode-base64": "Decode Base64 encoded payload?",
"outportph": "port" "outportph": "port"
}, },
"udpmsgs": "udp messages", "udpmsgs": "udp messages",
@ -412,19 +419,32 @@
} }
}, },
"switch": { "switch": {
"switch": "switch",
"label": { "label": {
"rule": "rule", "property": "Property",
"switchlabel": "switch" "rule": "rule"
}, },
"checkall": "checking all rules", "checkall": "checking all rules",
"stopfirst": "stopping after first match" "stopfirst": "stopping after first match",
"rules": {
"btwn":"is between",
"cont":"contains",
"regex":"matches regex",
"true":"is true",
"false":"is false",
"null":"is null",
"nnull":"is not null",
"else":"otherwise"
}
}, },
"change": { "change": {
"change": "change", "change": "change",
"label": { "label": {
"rules": "Rules", "rules": "Rules",
"rule": "rule" "rule": "rule",
"set": "set __property__",
"change": "change __property__",
"delete": "delete __property__",
"changeCount": "change: __count__ rules"
}, },
"set": "Set", "set": "Set",
"change": "Change", "change": "Change",
@ -434,26 +454,28 @@
"replace": "Replace with", "replace": "Replace with",
"regex": "Use regular expressions", "regex": "Use regular expressions",
"errors": { "errors": {
"invalid-from": "Invalid 'from' property:" "invalid-from": "Invalid 'from' property: __error__"
} }
}, },
"range": { "range": {
"range": "range",
"label": { "label": {
"action": "Action", "action": "Action",
"inputrange": "Map the input range", "inputrange": "Map the input range",
"resultrange": "to the result range", "resultrange": "to the result range",
"from": "from", "from": "from",
"to": "to", "to": "to",
"eg0ph": "e.g. 0", "roundresult": "Round result to the nearest integer?"
"eg99ph": "e.g. 99", },
"eg255ph": "e.g. 255", "placeholder": {
"roundresult": "Round result to the nearest integer?", "min": "e.g. 0",
"rangelabel": "range" "maxin": "e.g. 99",
"maxout": "e.g. 255"
},
"scale": {
"payload": "Scale msg.payload",
"limit": "Scale and limit to the target range",
"wrap": "Scale and wrap within the target range"
}, },
"scale-payload": "Scale msg.payload",
"scale-limit": "Scale and limit to the target range",
"scale-wrap": "Scale and wrap within the target range",
"tip": "Tip: This node ONLY works with numbers.", "tip": "Tip: This node ONLY works with numbers.",
"errors": { "errors": {
"notnumber": "Not a number" "notnumber": "Not a number"
@ -463,7 +485,6 @@
"csv": "csv", "csv": "csv",
"label": { "label": {
"columns": "Columns", "columns": "Columns",
"columnsph": "comma-separated column names",
"separator": "Separator", "separator": "Separator",
"c2o": "CSV-to-Object options", "c2o": "CSV-to-Object options",
"o2c": "Object-to-CSV options", "o2c": "Object-to-CSV options",
@ -473,42 +494,53 @@
"includerow": "include column name row", "includerow": "include column name row",
"newline": "Newline" "newline": "Newline"
}, },
"placeholder": {
"columns": "comma-separated column names"
},
"separator": {
"comma": "comma", "comma": "comma",
"tab": "tab", "tab": "tab",
"space": "space", "space": "space",
"semicolon": "semicolon", "semicolon": "semicolon",
"colon": "colon", "colon": "colon",
"hashtag": "hashtag", "hashtag": "hashtag",
"other": "other...", "other": "other..."
},
"output": {
"row": "a message per row", "row": "a message per row",
"array": "a single message [array]", "array": "a single message [array]"
},
"newline": {
"linux": "Linux (\\n)", "linux": "Linux (\\n)",
"mac": "Mac (\\r)", "mac": "Mac (\\r)",
"windows": "Windows (\\r\\n)", "windows": "Windows (\\r\\n)"
},
"errors": { "errors": {
"csv_js": "This node only handles csv strings or js objects." "csv_js": "This node only handles csv strings or js objects."
} }
}, },
"html": { "html": {
"html": "html",
"label": { "label": {
"select": "Select", "select": "Select",
"output": "Output" "output": "Output"
}, },
"htmlcontent": "the html content of the elements", "output": {
"textcontent": "only the text content of the elements", "html": "the html content of the elements",
"text": "only the text content of the elements"
},
"format": {
"single": "as a single message containing an array", "single": "as a single message containing an array",
"multi": "as multiple messages, one for each element", "multi": "as multiple messages, one for each element"
},
"tip": "Tip: The <b>Select</b> value is a <a href=\"https://github.com/fb55/CSSselect#user-content-supported-selectors\" target=\"_new\"><i><u>CSS Selector</u></i></a>, similar to a jQuery selector." "tip": "Tip: The <b>Select</b> value is a <a href=\"https://github.com/fb55/CSSselect#user-content-supported-selectors\" target=\"_new\"><i><u>CSS Selector</u></i></a>, similar to a jQuery selector."
}, },
"json": { "json": {
"json": "json",
"errors": { "errors": {
"dropped": "Dropped" "dropped-object": "Ignored non-object payload",
"dropped": "Ignored unsupported payload type"
} }
}, },
"xml": { "xml": {
"xml": "xml",
"label": { "label": {
"represent": "Represent XML tag attributes as a property named", "represent": "Represent XML tag attributes as a property named",
"prefix": "Prefix to access character content", "prefix": "Prefix to access character content",
@ -519,9 +551,6 @@
"xml_js": "This node only handles xml strings or js objects." "xml_js": "This node only handles xml strings or js objects."
} }
}, },
"sentiment": {
"sentiment": "sentiment"
},
"arduino": { "arduino": {
"arduino": "arduino", "arduino": "arduino",
"label": { "label": {
@ -557,10 +586,10 @@
"label": { "label": {
"gpiopin": "GPIO Pin", "gpiopin": "GPIO Pin",
"selectpin": "select pin", "selectpin": "select pin",
"registor": "Registor ?", "registor": "Registor?",
"readinitial": "Read initial state of pin on deploy/restart ?", "readinitial": "Read initial state of pin on deploy/restart?",
"type": "Type", "type": "Type",
"initpin": "Initialise pin state ?", "initpin": "Initialise pin state?",
"button": "Button", "button": "Button",
"pimouse": "Pi Mouse", "pimouse": "Pi Mouse",
"left": "Left", "left": "Left",
@ -613,7 +642,7 @@
"label": { "label": {
"filename": "Filename", "filename": "Filename",
"filenameph": "filename", "filenameph": "filename",
"splitlines": "Split lines if we see \\n ?" "splitlines": "Split lines if we see \\n?"
}, },
"errors": { "errors": {
"windowsnotsupport": "Info : Currently not supported on Windows." "windowsnotsupport": "Info : Currently not supported on Windows."
@ -625,7 +654,7 @@
"filename": "Filename", "filename": "Filename",
"filenameph": "filename", "filenameph": "filename",
"action": "Action", "action": "Action",
"addnewline": "Add newline (\\n) to each payload ?", "addnewline": "Add newline (\\n) to each payload?",
"outputas": "Ourput as", "outputas": "Ourput as",
"filelabel": "file", "filelabel": "file",
"deletelabel": "delete" "deletelabel": "delete"
@ -750,8 +779,8 @@
"action": "Action", "action": "Action",
"port": "Port", "port": "Port",
"portph": "port", "portph": "port",
"ssl": "Use Secure SSL connection ?", "ssl": "Use Secure SSL connection?",
"self": "Allow self-signed certificates ?", "self": "Allow self-signed certificates?",
"nickname": "Nickname" "nickname": "Nickname"
}, },
"payload": "Send payload to channel(s)", "payload": "Send payload to channel(s)",
@ -769,7 +798,7 @@
"ping": "PING from", "ping": "PING from",
"quit": "QUIT", "quit": "QUIT",
"restart": "restart", "restart": "restart",
"connectionlost": "CONNECTION LOST ?", "connectionlost": "CONNECTION LOST?",
"hasjoined": "has joined", "hasjoined": "has joined",
"sentinvite": "sent invite to", "sentinvite": "sent invite to",
"hasleft": "has left", "hasleft": "has left",

View File

@ -20,7 +20,7 @@
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name"> <input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div> </div>
<div class="form-row"> <div class="form-row">
If msg.<input type="text" id="node-input-property" style="width: 200px;"/> <span data-i18n="switch.label.property"></span> msg.<input type="text" id="node-input-property" style="width: 200px;"/>
</div> </div>
<div class="form-row node-input-rule-container-row" style="margin-bottom: 0px;"> <div class="form-row node-input-rule-container-row" style="margin-bottom: 0px;">
<div id="node-input-rule-container-div" style="box-sizing: border-box; border-radius: 5px; height: 310px; padding: 5px; border: 1px solid #ccc; overflow-y:scroll;"> <div id="node-input-rule-container-div" style="box-sizing: border-box; border-radius: 5px; height: 310px; padding: 5px; border: 1px solid #ccc; overflow-y:scroll;">
@ -61,7 +61,7 @@
outputs: 1, outputs: 1,
icon: "switch.png", icon: "switch.png",
label: function() { label: function() {
return this.name||this._("switch.label.switchlabel"); return this.name||"switch";
}, },
oneditprepare: function() { oneditprepare: function() {
@ -72,14 +72,14 @@
{v:"lte",t:"<="}, {v:"lte",t:"<="},
{v:"gt",t:">"}, {v:"gt",t:">"},
{v:"gte",t:">="}, {v:"gte",t:">="},
{v:"btwn",t:"is between"}, {v:"btwn",t:this._("switch.rules.btwn")},
{v:"cont",t:"contains"}, {v:"cont",t:this._("switch.rules.cont")},
{v:"regex",t:"matches regex"}, {v:"regex",t:this._("switch.rules.regex")},
{v:"true",t:"is true"}, {v:"true",t:this._("switch.rules.true")},
{v:"false",t:"is false"}, {v:"false",t:this._("switch.rules.false")},
{v:"null",t:"is null"}, {v:"null",t:this._("switch.rules.null")},
{v:"nnull",t:"is not null"}, {v:"nnull",t:this._("switch.rules.nnull")},
{v:"else",t:"otherwise"} {v:"else",t:this._("switch.rules.else")}
]; ];
function generateRule(i,rule) { function generateRule(i,rule) {

View File

@ -68,23 +68,23 @@
} }
if (!this.rules) { if (!this.rules) {
if (this.action === "replace") { if (this.action === "replace") {
return "set msg."+this.property; return this._("change.label.set",{property:"msg."+this.property});
} else if (this.action === "change") { } else if (this.action === "change") {
return "change msg."+this.property; return this._("change.label.change",{property:"msg."+this.property});
} else { } else {
return this.action+" msg."+this.property return this._("change.label.delete",{property:"msg."+this.property});
} }
} else { } else {
if (this.rules.length == 1) { if (this.rules.length == 1) {
if (this.rules[0].t === "set") { if (this.rules[0].t === "set") {
return "set msg."+this.rules[0].p; return this._("change.label.set",{property:"msg."+this.rules[0].p});
} else if (this.rules[0].t === "change") { } else if (this.rules[0].t === "change") {
return "change msg."+this.rules[0].p; return this._("change.label.change",{property:"msg."+this.rules[0].p});
} else { } else {
return "delete msg."+this.rules[0].p; return this._("change.label.delete",{property:"msg."+this.rules[0].p});
} }
} else { } else {
return "change: "+(this.rules.length||"no")+" rules"; return this._("change.label.changeCount",{count:this.rules.length});
} }
} }
}, },
@ -154,7 +154,6 @@
} else if (type == "delete") { } else if (type == "delete") {
row2.hide(); row2.hide();
row3.hide(); row3.hide();
$("#node-tip").hide();
} }
}); });
deleteButton.click(function() { deleteButton.click(function() {

View File

@ -52,7 +52,7 @@ module.exports = function(RED) {
rule.from = new RegExp(rule.from, "g"); rule.from = new RegExp(rule.from, "g");
} catch (e) { } catch (e) {
valid = false; valid = false;
this.error(RED._("change.errors.invalid-from")+" "+e.message); this.error(RED._("change.errors.invalid-from",{error:e.message}));
} }
} }
} }

View File

@ -18,21 +18,21 @@
<div class="form-row"> <div class="form-row">
<label for="node-input-action"><i class="fa fa-dot-circle-o"></i> <span data-i18n="range.label.action"></span></label> <label for="node-input-action"><i class="fa fa-dot-circle-o"></i> <span data-i18n="range.label.action"></span></label>
<select id="node-input-action" style="width:70%; margin-right:5px;"> <select id="node-input-action" style="width:70%; margin-right:5px;">
<option value="scale" data-i18n="range.scale-payload"></option> <option value="scale" data-i18n="range.scale.payload"></option>
<option value="clamp" data-i18n="range.scale-limit"></option> <option value="clamp" data-i18n="range.scale.limit"></option>
<option value="roll" data-i18n="range.scale-wrap"></option> <option value="roll" data-i18n="range.scale.wrap"></option>
</select> </select>
</div> </div>
<br/> <br/>
<div class="form-row"><i class="fa fa-sign-in"></i> <span data-i18n="range.label.inputrange"></span>:</div> <div class="form-row"><i class="fa fa-sign-in"></i> <span data-i18n="range.label.inputrange"></span>:</div>
<div class="form-row"><label></label> <div class="form-row"><label></label>
<span data-i18n="range.label.from"></span>: <input type="text" id="node-input-minin" data-i18n="[placeholder]range.label.eg0ph" style="width:100px;"/> <span data-i18n="range.label.from"></span>: <input type="text" id="node-input-minin" data-i18n="[placeholder]range.placeholder.min" style="width:100px;"/>
&nbsp;&nbsp;<span data-i18n="range.label.to"></span>: <input type="text" id="node-input-maxin" data-i18n="[placeholder]range.label.eg99ph" style="width:100px;"/> &nbsp;&nbsp;<span data-i18n="range.label.to"></span>: <input type="text" id="node-input-maxin" data-i18n="[placeholder]range.placeholder.maxin" style="width:100px;"/>
</div> </div>
<div class="form-row"><i class="fa fa-sign-out"></i> <span data-i18n="range.label.resultrange"></span>:</div> <div class="form-row"><i class="fa fa-sign-out"></i> <span data-i18n="range.label.resultrange"></span>:</div>
<div class="form-row"><label></label> <div class="form-row"><label></label>
<span data-i18n="range.label.from"></span>: <input type="text" id="node-input-minout" data-i18n="[placeholder]range.label.eg0ph" style="width:100px;"/> <span data-i18n="range.label.from"></span>: <input type="text" id="node-input-minout" data-i18n="[placeholder]range.placeholder.min" style="width:100px;"/>
&nbsp;&nbsp;<span data-i18n="range.label.to"></span>: <input type="text" id="node-input-maxout" data-i18n="[placeholder]range.label.eg255ph" style="width:100px;"/> &nbsp;&nbsp;<span data-i18n="range.label.to"></span>: <input type="text" id="node-input-maxout" data-i18n="[placeholder]range.placeholder.maxout" style="width:100px;"/>
</div> </div>
<br/> <br/>
<div class="form-row"><label></label> <div class="form-row"><label></label>
@ -72,7 +72,7 @@
outputs: 1, outputs: 1,
icon: "range.png", icon: "range.png",
label: function() { label: function() {
return this.name || this._("range.label.rangelabel"); return this.name || "range";
}, },
labelStyle: function() { labelStyle: function() {
return this.name ? "node_label_italic" : ""; return this.name ? "node_label_italic" : "";

View File

@ -18,18 +18,18 @@
<script type="text/x-red" data-template-name="csv"> <script type="text/x-red" data-template-name="csv">
<div class="form-row"> <div class="form-row">
<label for="node-input-temp"><i class="fa fa-list"></i> <span data-i18n="csv.label.columns"></span></label> <label for="node-input-temp"><i class="fa fa-list"></i> <span data-i18n="csv.label.columns"></span></label>
<input type="text" id="node-input-temp" data-i18n="[placeholder]csv.label.columnsph"> <input type="text" id="node-input-temp" data-i18n="[placeholder]csv.placeholder.columns">
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-input-select-sep"><i class="fa fa-text-width"></i> <span data-i18n="csv.label.separator"></span></label> <label for="node-input-select-sep"><i class="fa fa-text-width"></i> <span data-i18n="csv.label.separator"></span></label>
<select style="width: 150px" id="node-input-select-sep"> <select style="width: 150px" id="node-input-select-sep">
<option value="," data-i18n="csv.comma"></option> <option value="," data-i18n="csv.separator.comma"></option>
<option value="\t" data-i18n="csv.tab"></option> <option value="\t" data-i18n="csv.separator.tab"></option>
<option value=" " data-i18n="csv.space"></option> <option value=" " data-i18n="csv.separator.space"></option>
<option value=";" data-i18n="csv.semicolon"></option> <option value=";" data-i18n="csv.separator.semicolon"></option>
<option value=":" data-i18n="csv.colon"></option> <option value=":" data-i18n="csv.separator.colon"></option>
<option value="#" data-i18n="csv.hashtag"></option> <option value="#" data-i18n="csv.separator.hashtag"></option>
<option value="" data-i18n="csv.other"></option> <option value="" data-i18n="csv.separator.other"></option>
</select> </select>
<input style="width: 40px;" type="text" id="node-input-sep" pattern="."> <input style="width: 40px;" type="text" id="node-input-sep" pattern=".">
</div> </div>
@ -47,8 +47,8 @@
<div class="form-row"> <div class="form-row">
<label style="margin-left: 10px; margin-right: -10px;"><i class="fa fa-sign-out"></i> <span data-i18n="csv.label.output"></span></label> <label style="margin-left: 10px; margin-right: -10px;"><i class="fa fa-sign-out"></i> <span data-i18n="csv.label.output"></span></label>
<select type="text" id="node-input-multi" style="width: 250px;"> <select type="text" id="node-input-multi" style="width: 250px;">
<option value="one" data-i18n="csv.row"></option> <option value="one" data-i18n="csv.output.row"></option>
<option value="mult" data-i18n="csv.array"></option> <option value="mult" data-i18n="csv.output.array"></option>
</select> </select>
</div> </div>
<hr align="middle"/> <hr align="middle"/>
@ -60,9 +60,9 @@
<div class="form-row"> <div class="form-row">
<label style="margin-left: 10px; margin-right: -10px;"><i class="fa fa-align-left"></i> <span data-i18n="csv.label.newline"></span></label> <label style="margin-left: 10px; margin-right: -10px;"><i class="fa fa-align-left"></i> <span data-i18n="csv.label.newline"></span></label>
<select style="width: 150px" id="node-input-ret"> <select style="width: 150px" id="node-input-ret">
<option value='\n' data-i18n="csv.linux"></option> <option value='\n' data-i18n="csv.newline.linux"></option>
<option value='\r' data-i18n="csv.mac"></option> <option value='\r' data-i18n="csv.newline.mac"></option>
<option value='\r\n' data-i18n="csv.windows"></option> <option value='\r\n' data-i18n="csv.newline.windows"></option>
</select> </select>
</div> </div>
</script> </script>

View File

@ -22,8 +22,8 @@
<div class="form-row"> <div class="form-row">
<label for="node-input-ret"><i class="fa fa-sign-out"></i> <span data-i18n="html.label.output"></span></label> <label for="node-input-ret"><i class="fa fa-sign-out"></i> <span data-i18n="html.label.output"></span></label>
<select id="node-input-ret" style="width:76% !important"> <select id="node-input-ret" style="width:76% !important">
<option value="html" data-i18n="html.htmlcontent"></option> <option value="html" data-i18n="html.output.html"></option>
<option value="text"data-i18n="html.textcontent"></option> <option value="text"data-i18n="html.output.text"></option>
<!-- <option value="attr">an object of any attributes</option> --> <!-- <option value="attr">an object of any attributes</option> -->
<!-- <option value="val">return the value from a form element</option> --> <!-- <option value="val">return the value from a form element</option> -->
</select> </select>
@ -31,8 +31,8 @@
<div class="form-row"> <div class="form-row">
<label for="node-input-as">&nbsp;</label> <label for="node-input-as">&nbsp;</label>
<select id="node-input-as" style="width:76% !important"> <select id="node-input-as" style="width:76% !important">
<option value="single" data-i18n="html.single"></option> <option value="single" data-i18n="html.format.single"></option>
<option value="multi" data-i18n="html.multi"></option> <option value="multi" data-i18n="html.format.multi"></option>
</select> </select>
</div> </div>
<br/> <br/>

View File

@ -35,9 +35,9 @@ module.exports = function(RED) {
msg.payload = JSON.stringify(msg.payload); msg.payload = JSON.stringify(msg.payload);
node.send(msg); node.send(msg);
} }
else { node.warn(RED._("json.errors.dropped")+": "+msg.payload); } else { node.warn(RED._("json.errors.dropped-object")); }
} }
else { node.warn(RED._("json.errors.dropped")+": "+msg.payload); } else { node.warn(RED._("json.errors.dropped")); }
} }
else { node.send(msg); } // If no payload - just pass it on. else { node.send(msg); } // If no payload - just pass it on.
}); });

View File

@ -105,13 +105,13 @@ describe('JSON node', function() {
//console.log(logEvents); //console.log(logEvents);
logEvents.should.have.length(4); logEvents.should.have.length(4);
logEvents[0][0].should.have.a.property('msg'); logEvents[0][0].should.have.a.property('msg');
logEvents[0][0].msg.toString().should.startWith('json.errors.dropped: '); logEvents[0][0].msg.toString().should.eql('json.errors.dropped');
logEvents[1][0].should.have.a.property('msg'); logEvents[1][0].should.have.a.property('msg');
logEvents[1][0].msg.toString().should.startWith('json.errors.dropped: '); logEvents[1][0].msg.toString().should.eql('json.errors.dropped');
logEvents[2][0].should.have.a.property('msg'); logEvents[2][0].should.have.a.property('msg');
logEvents[2][0].msg.toString().should.startWith('json.errors.dropped: '); logEvents[2][0].msg.toString().should.eql('json.errors.dropped-object');
logEvents[3][0].should.have.a.property('msg'); logEvents[3][0].should.have.a.property('msg');
logEvents[3][0].msg.toString().should.startWith('json.errors.dropped: '); logEvents[3][0].msg.toString().should.eql('json.errors.dropped-object');
done(); done();
} catch(err) { } catch(err) {
done(err); done(err);

View File

@ -350,7 +350,6 @@ describe('file Nodes', function() {
var logEvents = helper.log().args.filter(function(evt) { var logEvents = helper.log().args.filter(function(evt) {
return evt[0].type == "file in"; return evt[0].type == "file in";
}); });
console.log(logEvents[0][0].msg);
logEvents.should.have.length(1); logEvents.should.have.length(1);
logEvents[0][0].should.have.a.property('msg'); logEvents[0][0].should.have.a.property('msg');
//logEvents[0][0].msg.toString().should.equal("Error: ENOENT, open 'badfile'"); //logEvents[0][0].msg.toString().should.equal("Error: ENOENT, open 'badfile'");