mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Fix merge conflicts on i18n
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Copyright 2013,2015 IBM Corp.
|
||||
Copyright 2013,2014 IBM Corp.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -16,20 +16,20 @@
|
||||
|
||||
<script type="text/x-red" data-template-name="serial in">
|
||||
<div class="form-row node-input-serial">
|
||||
<label for="node-input-serial"><i class="fa fa-random"></i> Serial Port</label>
|
||||
<label for="node-input-serial"><i class="fa fa-random"></i> <span data-i18n="serial.label.serialport"></span></label>
|
||||
<input type="text" id="node-input-serial">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="serial in">
|
||||
<p>Reads data from a local serial port.</p>
|
||||
<p>Can either <ul><li>wait for a "split" character (default \n). Also accepts hex notation (0x0a).</li>
|
||||
<li>wait for a timeout in milliseconds for the first character received</li>
|
||||
<li>wait to fill a fixed sized buffer</li></ul></p>
|
||||
<li>Wait for a timeout in milliseconds for the first character received</li>
|
||||
<li>Wait to fill a fixed sized buffer</li></ul></p>
|
||||
<p>It then outputs <b>msg.payload</b> as either a UTF8 ascii string or a binary Buffer object.</p>
|
||||
<p>If no split character is specified, or a timeout or buffer size of 0, then a stream of single characters is sent - again either as ascii chars or size 1 binary buffers.</p>
|
||||
</script>
|
||||
@@ -47,7 +47,7 @@
|
||||
icon: "serial.png",
|
||||
label: function() {
|
||||
var serialNode = RED.nodes.node(this.serial);
|
||||
return this.name||(serialNode?serialNode.label().split(":")[0]:"serial");
|
||||
return this.name||(serialNode?serialNode.label().split(":")[0]:this._("serial.label.serial"));
|
||||
},
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
@@ -57,12 +57,12 @@
|
||||
|
||||
<script type="text/x-red" data-template-name="serial out">
|
||||
<div class="form-row node-input-serial">
|
||||
<label for="node-input-serial"><i class="fa fa-random"></i> Serial Port</label>
|
||||
<label for="node-input-serial"><i class="fa fa-random"></i> <span data-i18n="serial.label.serialport"></span></label>
|
||||
<input type="text" id="node-input-serial">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
align: "right",
|
||||
label: function() {
|
||||
var serialNode = RED.nodes.node(this.serial);
|
||||
return this.name||(serialNode?serialNode.label().split(":")[0]:"serial");
|
||||
return this.name||(serialNode?serialNode.label().split(":")[0]:this._("serial.label.serial"));
|
||||
},
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
@@ -97,17 +97,17 @@
|
||||
|
||||
<script type="text/x-red" data-template-name="serial-port">
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-serialport"><i class="fa fa-random"></i> Serial Port</label>
|
||||
<input type="text" id="node-config-input-serialport" style="width:60%;" placeholder="/dev/ttyUSB0"/>
|
||||
<label for="node-config-input-serialport"><i class="fa fa-random"></i> <span data-i18n="serial.label.serialport"></span></label>
|
||||
<input type="text" id="node-config-input-serialport" style="width:60%;" data-i18n="[placeholder]serial.placeholder.serialport">
|
||||
<a id="node-config-lookup-serial" class="btn"><i id="node-config-lookup-serial-icon" class="fa fa-search"></i></a>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<table><tr>
|
||||
<td width="102px"><i class="fa fa-wrench"></i> Settings</td>
|
||||
<td width="100px">Baud Rate</td>
|
||||
<td width="80px">Data Bits</td>
|
||||
<td width="80px">Parity</td>
|
||||
<td width="80px">Stop Bits</td>
|
||||
<td width="102px"><i class="fa fa-wrench"></i> <span data-i18n="serial.label.settings"></span></td>
|
||||
<td width="100px" data-i18n="serial.label.baudrate"></td>
|
||||
<td width="80px" data-i18n="serial.label.databits"></td>
|
||||
<td width="80px" data-i18n="serial.label.parity"></td>
|
||||
<td width="80px" data-i18n="serial.label.stopbits"></td>
|
||||
</tr><tr><td> </td>
|
||||
<td>
|
||||
<select type="text" id="node-config-input-serialbaud" style="width: 100px;">
|
||||
@@ -138,11 +138,11 @@
|
||||
</select>
|
||||
</td><td>
|
||||
<select type="text" id="node-config-input-parity" style="width: 80px;">
|
||||
<option value="none">None</option>
|
||||
<option value="even">Even</option>
|
||||
<option value="mark">Mark</option>
|
||||
<option value="odd">Odd</option>
|
||||
<option value="space">Space</option>
|
||||
<option value="none" data-i18n="serial.parity.none"></option>
|
||||
<option value="even" data-i18n="serial.parity.even"></option>
|
||||
<option value="mark" data-i18n="serial.parity.mark"></option>
|
||||
<option value="odd" data-i18n="serial.parity.odd"></option>
|
||||
<option value="space" data-i18n="serial.parity.space"></option>
|
||||
</select>
|
||||
</td><td>
|
||||
<select type="text" id="node-config-input-stopbits" style="width: 80px;">
|
||||
@@ -153,36 +153,36 @@
|
||||
</tr></table><br/>
|
||||
|
||||
<div class="form-row">
|
||||
<label><i class="fa fa-sign-in"></i> Input</label>
|
||||
<label><i class="fa fa-sign-in"></i> <span data-i18n="serial.label.input"></span></label>
|
||||
</div>
|
||||
<div class="form-row" style="padding-left: 10px;">
|
||||
Split input
|
||||
<span data-i18n="serial.label.split"></span>
|
||||
<select type="text" id="node-config-input-out" style="margin-left: 5px; width:200px;">
|
||||
<option value="char">on the character</option>
|
||||
<option value="time">after a timeout of</option>
|
||||
<option value="count">into fixed lengths of</option>
|
||||
<option value="char" data-i18n="serial.split.character"></option>
|
||||
<option value="time" data-i18n="serial.split.timeout"></option>
|
||||
<option value="count" data-i18n="serial.split.lengths"></option>
|
||||
</select>
|
||||
<input type="text" id="node-config-input-newline" style="width:50px;">
|
||||
<span id="node-units"></span>
|
||||
</div>
|
||||
<div class="form-row" style="padding-left: 10px;">
|
||||
and deliver
|
||||
<span data-i18n="serial.label.deliver"></span>
|
||||
<select type="text" id="node-config-input-bin" style="margin-left: 5px; width: 150px;">
|
||||
<option value="false">ascii strings</option>
|
||||
<option value="bin">binary buffers</option>
|
||||
<option value="false" data-i18n="serial.output.ascii"></option>
|
||||
<option value="bin" data-i18n="serial.output.binary"></option>
|
||||
</select>
|
||||
</div>
|
||||
<br/>
|
||||
<div id="node-config-addchar">
|
||||
<div class="form-row">
|
||||
<label><i class="fa fa-sign-out"></i> Output</label>
|
||||
<label><i class="fa fa-sign-out"></i> <span data-i18n="serial.label.output"></span></label>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<input style="width: 30px;margin-left: 10px; vertical-align: top;" type="checkbox" id="node-config-input-addchar"><label style="width: auto;" for="node-config-input-addchar">add split character to output messages</label>
|
||||
<input style="width: 30px;margin-left: 10px; vertical-align: top;" type="checkbox" id="node-config-input-addchar"><label style="width: auto;" for="node-config-input-addchar"><span data-i18n="serial.addsplit"></span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-tips" id="tip-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.</div>
|
||||
<div class="form-tips" id="tip-bin" hidden>Tip: In timeout mode timeout starts from arrival of first character.</div>
|
||||
<div class="form-tips" id="tip-split"><span data-i18n="serial.tip.split"></span></div>
|
||||
<div class="form-tips" id="tip-bin" hidden><span data-i18n="serial.tip.timeout"></span></div>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -203,7 +203,7 @@
|
||||
label: function() {
|
||||
this.serialbaud = this.serialbaud || 57600;
|
||||
this.databits = this.databits || 8;
|
||||
this.parity = this.parity || 'none';
|
||||
this.parity = this.parity || this._("serial.label.none");
|
||||
this.stopbits = this.stopbits || 1;
|
||||
return this.serialport+":"+this.serialbaud+"-"+this.databits+this.parity.charAt(0).toUpperCase()+this.stopbits;
|
||||
},
|
||||
|
@@ -76,13 +76,13 @@ module.exports = function(RED) {
|
||||
}
|
||||
});
|
||||
node.port.on('ready', function() {
|
||||
node.status({fill:"green",shape:"dot",text:"connected"});
|
||||
node.status({fill:"green",shape:"dot",text:"node-red:common.status.connected"});
|
||||
});
|
||||
node.port.on('closed', function() {
|
||||
node.status({fill:"red",shape:"ring",text:"not connected"});
|
||||
node.status({fill:"red",shape:"ring",text:"node-red:common.status.not-connected"});
|
||||
});
|
||||
} else {
|
||||
this.error("missing serial config");
|
||||
this.error(RED._("serial.errors.missing-conf"));
|
||||
}
|
||||
|
||||
this.on("close", function(done) {
|
||||
@@ -108,7 +108,7 @@ module.exports = function(RED) {
|
||||
if (node.serialConfig.out != "count") { buf = new Buffer(bufMaxSize); }
|
||||
else { buf = new Buffer(Number(node.serialConfig.newline)); }
|
||||
var i = 0;
|
||||
node.status({fill:"grey",shape:"dot",text:"unknown"});
|
||||
node.status({fill:"grey",shape:"dot",text:"node-red:common.status.not-connected"});
|
||||
node.port = serialPool.get(this.serialConfig.serialport,
|
||||
this.serialConfig.serialbaud,
|
||||
this.serialConfig.databits,
|
||||
@@ -176,17 +176,16 @@ module.exports = function(RED) {
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
else { node.log("should never get here"); }
|
||||
}
|
||||
});
|
||||
this.port.on('ready', function() {
|
||||
node.status({fill:"green",shape:"dot",text:"connected"});
|
||||
node.status({fill:"green",shape:"dot",text:"node-red:common.status.connected"});
|
||||
});
|
||||
this.port.on('closed', function() {
|
||||
node.status({fill:"red",shape:"ring",text:"not connected"});
|
||||
node.status({fill:"red",shape:"ring",text:"node-red:common.status.not-connected"});
|
||||
});
|
||||
} else {
|
||||
this.error("missing serial config");
|
||||
this.error(RED._("serial.errors.missing-conf"));
|
||||
}
|
||||
|
||||
this.on("close", function(done) {
|
||||
@@ -226,7 +225,7 @@ module.exports = function(RED) {
|
||||
parser: serialp.parsers.raw
|
||||
},true, function(err, results) { if (err) { obj.serial.emit('error',err); } });
|
||||
obj.serial.on('error', function(err) {
|
||||
RED.log.error("serial port "+port+" error "+err);
|
||||
RED.log.error(RED._("serial.errors.error",{port:port,error:err.toString()}));
|
||||
obj._emitter.emit('closed');
|
||||
obj.tout = setTimeout(function() {
|
||||
setupSerial();
|
||||
@@ -234,7 +233,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
obj.serial.on('close', function() {
|
||||
if (!obj._closing) {
|
||||
RED.log.error("serial port "+port+" closed unexpectedly");
|
||||
RED.log.error(RED._("serial.errors.unexpected-close",{port:port}));
|
||||
obj._emitter.emit('closed');
|
||||
obj.tout = setTimeout(function() {
|
||||
setupSerial();
|
||||
@@ -242,7 +241,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
});
|
||||
obj.serial.on('open',function() {
|
||||
RED.log.info("serial port "+port+" opened at "+baud+" baud "+databits+""+parity.charAt(0).toUpperCase()+stopbits);
|
||||
RED.log.info(RED._("serial.onopen",{port:port,baud:baud,config: databits+""+parity.charAt(0).toUpperCase()+stopbits}));
|
||||
if (obj.tout) { clearTimeout(obj.tout); }
|
||||
//obj.serial.flush();
|
||||
obj._emitter.emit('ready');
|
||||
@@ -253,7 +252,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
});
|
||||
obj.serial.on("disconnect",function() {
|
||||
RED.log.error("serial port "+port+" gone away");
|
||||
RED.log.error(RED._("serial.errors.disconnected",{port:port}));
|
||||
});
|
||||
}
|
||||
setupSerial();
|
||||
@@ -270,7 +269,7 @@ module.exports = function(RED) {
|
||||
connections[port]._closing = true;
|
||||
try {
|
||||
connections[port].close(function() {
|
||||
RED.log.info("serial port closed");
|
||||
RED.log.info(RED._("serial.errors.closed",{port:port}));
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
51
io/serialport/locales/en-US/25-serial.json
Normal file
51
io/serialport/locales/en-US/25-serial.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"serial": {
|
||||
"label": {
|
||||
"serialport": "Serial Port",
|
||||
"settings": "Settings",
|
||||
"baudrate": "Baud Rate",
|
||||
"databits": "Data Bits",
|
||||
"parity": "Parity",
|
||||
"stopbits": "Stop Bits",
|
||||
"input": "Input",
|
||||
"split": "Split input",
|
||||
"deliver": "and deliver",
|
||||
"output": "Output",
|
||||
"serial": "serial",
|
||||
"none": "none"
|
||||
},
|
||||
"placeholder": {
|
||||
"serialport": "for example: /dev/ttyUSB0/"
|
||||
},
|
||||
"parity": {
|
||||
"none": "None",
|
||||
"even": "Even",
|
||||
"mark": "Mark",
|
||||
"odd": "Odd",
|
||||
"space": "Space"
|
||||
},
|
||||
"split": {
|
||||
"character": "on the character",
|
||||
"timeout": "after a timeout of",
|
||||
"lengths": "into fixed lengths of"
|
||||
},
|
||||
"output": {
|
||||
"ascii": "ascii strings",
|
||||
"binary": "binary buffers"
|
||||
},
|
||||
"addsplit": "add split character to output messages",
|
||||
"tip": {
|
||||
"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": {
|
||||
"missing-conf": "missing serial config",
|
||||
"serial-port": "serial port",
|
||||
"error": "serial port __port__ error: __error__",
|
||||
"unexpected-close": "serial port __port__ closed unexpectedly",
|
||||
"disconnected": "serial port __port__ disconnected",
|
||||
"closed": "serial port __port__ closed"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user