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,
icon: "arrow-in.png",
label: function() {
return this.name||this._("sentiment.sentiment");
return this.name||"sentiment";
},
labelStyle: function() {
return this.name?"node_label_italic":"";

View File

@ -109,16 +109,16 @@
if (this.pauseType == "delay") {
var units = this.timeoutUnits ? this.timeoutUnits.charAt(0) : "s";
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") {
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") {
return this.name || this._("delay.randomlabel");
return this.name || this._("delay.label.random");
}
else {
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

View File

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

View File

@ -16,17 +16,17 @@
<script type="text/x-red" data-template-name="comment">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-comment"></i> <span data-i18n="comment.title"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]comment.comment">
<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">
</div>
<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">
</div>
<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 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 type="text/x-red" data-help-name="comment">
@ -51,8 +51,8 @@
return this.name?"node_label_italic":"";
},
info: function() {
var t = this.name || this._("comment.commentnode");
var b = this.info || this._("comment.commentinfo");
var t = this.name || this._("comment.defaulttitle");
var b = this.info || this._("comment.defaultinfo");
return "### "+t+"\n"+b;
},
oneditprepare: function() {

View File

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

View File

@ -13,63 +13,6 @@
See the License for the specific language governing permissions and
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 -->
<script type="text/x-red" data-template-name="websocket in">
<div class="form-row">
@ -101,6 +44,65 @@ function ws_validateclient() {
</script>
<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',{
category: 'input',
defaults: {
@ -119,6 +121,75 @@ function ws_validateclient() {
oneditsave: ws_oneditsave,
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>
<!-- WebSocket out Node -->
@ -157,28 +228,6 @@ function ws_validateclient() {
should delete the <b>msg._session</b> property within the flow</p>.
</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 -->
<script type="text/x-red" data-template-name="websocket-listener">
<div class="form-row">
@ -202,42 +251,6 @@ function ws_validateclient() {
<p>This configuration node creates a WebSocket Server using the specified path</p>
</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 -->
<script type="text/x-red" data-template-name="websocket-client">
<div class="form-row">
@ -261,17 +274,3 @@ function ws_validateclient() {
<p>This configuration node connects a WebSocket client to the specified URL.</p>
</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">
<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>
<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 class="form-row">
<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">
<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;">
<option value="server" data-i18n="tcpin.listen"></option>
<option value="client" data-i18n="tcpin.connect"></option>
<option value="server" data-i18n="tcpin.type.listen"></option>
<option value="client" data-i18n="tcpin.type.connect"></option>
</select>
<span data-i18n="tcpin.label.port"></span> <input type="text" id="node-input-port" style="width: 50px">
</div>
@ -29,15 +29,14 @@
<div class="form-row">
<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;">
<option value="stream" data-i18n="tcpin.stream"></option>
<option value="single" data-i18n="tcpin.single"></option>
<option value="stream" data-i18n="tcpin.output.stream"></option>
<option value="single" data-i18n="tcpin.output.single"></option>
</select>
<select id="node-input-datatype" style="width:140px;">
<option value="buffer" data-i18n="tcpin.buffer"></option>
<option value="utf8" data-i18n="tcpin.string"></option>
<option value="base64" data-i18n="tcpin.base64"></option>
<option value="buffer" data-i18n="tcpin.output.buffer"></option>
<option value="utf8" data-i18n="tcpin.output.string"></option>
<option value="base64" data-i18n="tcpin.output.base64"></option>
</select>
<span data-i18n="tcpin.label.payload"></span>
</div>
@ -118,15 +117,15 @@
<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>
<select id="node-input-beserver" style="width:150px; margin-right:5px;">
<option value="server" data-i18n="tcpin.listen"></option>
<option value="client" data-i18n="tcpin.connect"></option>
<option value="reply" data-i18n="tcpin.reply"></option>
<option value="server" data-i18n="tcpin.type.listen"></option>
<option value="client" data-i18n="tcpin.type.connect"></option>
<option value="reply" data-i18n="tcpin.type.reply"></option>
</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>
</div>
<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 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>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</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 type="text/x-red" data-help-name="tcp out">
@ -199,17 +191,8 @@
if (sockettype == "client") {
$("#node-input-host-row").show();
$("#fin-tip").show();
} else {
$("#node-input-host-row").hide();
$("#fin-tip").hide();
}
if (sockettype == "server") {
$("#fin-tip2").show();
}
else {
$("#fin-tip2").hide();
}
};
updateOptions();
@ -223,15 +206,15 @@
<div class="form-row">
<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%">
&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 class="form-row">
<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%;">
<option value="time" data-i18n="tcpin.timeout"></option>
<option value="char" data-i18n="tcpin.character"></option>
<option value="count" data-i18n="tcpin.number"></option>
<option value="sit" data-i18n="tcpin.never"></option>
<option value="time" data-i18n="tcpin.return.timeout"></option>
<option value="char" data-i18n="tcpin.return.character"></option>
<option value="count" data-i18n="tcpin.return.number"></option>
<option value="sit" data-i18n="tcpin.return.never"></option>
</select>
<input type="text" id="node-input-splitc" style="width:50px;">
<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>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
<div class="form-tips"><span data-i18n="[html]tcpin.req-tip"></span></div>
<script>
var previous = null;
$("#node-input-out").on('focus', function () { previous = this.value; }).change(function() {

View File

@ -43,13 +43,13 @@ module.exports = function(RED) {
var reconnectTimeout;
var end = false;
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")});
var id = (1+Math.random()*4294967295).toString(16);
client = net.connect(node.port, node.host, function() {
buffer = (node.datatype == 'buffer')? new Buffer(0):"";
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")});
});
connectionPool[id] = client;
@ -103,7 +103,7 @@ module.exports = function(RED) {
reconnectTimeout = setTimeout(setupTcpClient, 20);
}
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);
}
} else {
@ -170,7 +170,7 @@ module.exports = function(RED) {
}
});
socket.on('timeout', function() {
node.log(RED._("tcpin.errors.timeout")+' '+node.port);
node.log(RED._("tcpin.errors.timeout",{port:node.port}));
socket.end();
});
socket.on('close', function() {
@ -183,15 +183,15 @@ module.exports = function(RED) {
});
server.on('error', function(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) {
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 {
node.log(RED._("tcpin.errors.listening-port")+' '+node.port);
node.log(RED._("tcpin.status.listening-port",{port:node.port}));
node.on('close', function() {
for (var c in connectionPool) {
if (connectionPool.hasOwnProperty(c)) {
@ -201,7 +201,7 @@ module.exports = function(RED) {
}
node.closing = true;
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 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")});
client = net.connect(node.port, node.host, function() {
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")});
});
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) {
});
@ -250,7 +250,7 @@ module.exports = function(RED) {
reconnectTimeout = setTimeout(setupTcpClient,20);
}
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);
}
} else {
@ -305,20 +305,20 @@ module.exports = function(RED) {
var server = net.createServer(function (socket) {
if (socketTimeout !== null) { socket.setTimeout(socketTimeout); }
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);
node.status({text:connectedSockets.length+" "+RED._("common.status.connections")});
socket.on('timeout', function() {
node.log(RED._("tcpin.errors.timeout")+' '+node.port);
node.log(RED._("tcpin.errors.timeout",{port:node.port}));
socket.end();
});
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);
node.status({text:connectedSockets.length+" "+RED._("common.status.connections")});
});
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);
node.status({text:connectedSockets.length+" "+RED._("common.status.connections")});
});
@ -343,15 +343,15 @@ module.exports = function(RED) {
server.on('error', function(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) {
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 {
node.log(RED._("tcpin.errors.listening-port")+' '+node.port);
node.log(RED._("tcpin.status.listening-port",{port:node.port}));
node.on('close', function() {
for (var c in connectedSockets) {
if (connectedSockets.hasOwnProperty(c)) {
@ -360,7 +360,7 @@ module.exports = function(RED) {
}
}
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() {
node.warn(RED._("tcpin.errors.timeout"));
node.warn(RED._("tcpin.errors.connect-timeout"));
if (client) {
client.end();
setTimeout(function() {

View File

@ -79,7 +79,6 @@
"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.",
"success": "Successfully injected: __label__",
"error": "<strong>Error</strong>: __message__",
"errors": {
"failed": "inject failed, see log for details"
}
@ -110,7 +109,7 @@
"placeholder": {
"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."
},
"function": {
@ -148,15 +147,17 @@
"rate": "Rate",
"msgper": "msg(s) per",
"dropmsg": "drop intermediate messages",
"delaylabel": "delay",
"label": {
"delay": "delay",
"limitlabel": "limit",
"randomlabel": "ramdom",
"queuelabel": "queue",
"msgperlabel": "msg/",
"buffererr": "buffer exceeded 1000 messages"
"queuelabel": "queue"
},
"error": {
"buffer": "buffer exceeded 1000 messages"
}
},
"trigger": {
"trigger": "trigger",
"output1": "Output",
"wait": "then wait",
"output2": "output",
@ -175,18 +176,17 @@
"triggeroncelabel": "trigger once & infinite"
},
"comment": {
"comment": "comment",
"label": {
"title": "Title",
"body": "Body - will be rendered in info tab.",
"tip1": "Tip: The text here can be styled as ",
"tip2": "Github flavoured Markdown",
"commentnode": "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*."
"body": "Body"
},
"tip": "Tip: The text can be styled as <a href=\"https://help.github.com/articles/markdown-basics/\" target=\"_new\">Github flavoured Markdown</a>",
"defaulttitle": "Comment node",
"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",
"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>"
},
@ -219,7 +219,7 @@
"return": "Return"
},
"setby": "- set by msg.method -",
"basicauth": "Use basic authentication ?",
"basicauth": "Use basic authentication?",
"utf8": "a UTF-8 string",
"binary": "a binary buffer",
"json": "a parsed JSON object",
@ -238,7 +238,6 @@
}
},
"websocket": {
"websocket": "websocket",
"label": {
"type": "Type",
"path": "Path",
@ -261,18 +260,17 @@
}
},
"watch": {
"watch": "watch",
"label": {
"files": "File(s)",
"filesph": "File(s) or Directory"
"files": "File(s)"
},
"placeholder": {
"files": "Comma-separated list of files and/or directories"
},
"tip": "On Windows you must use double back-slashes \\\\ in any directory names."
},
"serial": {
"serial": "serial",
"label": {
"serialport": "Serial Port",
"serialportph": "/dev/ttyUSB0/",
"settings": "Settings",
"baudrate": "Baud Rate",
"databits": "Data Bits",
@ -285,29 +283,38 @@
"serial": "serial",
"none": "none"
},
"placeholder": {
"serialport": "for example: /dev/ttyUSB0/"
},
"parity": {
"none": "None",
"even": "Even",
"mark": "Mark",
"odd": "Odd",
"space": "Space",
"space": "Space"
},
"split": {
"character": "on the character",
"timeout": "after a timeout of",
"length": "into fixed lengths of",
"length": "into fixed lengths of"
},
"output": {
"ascii": "ascii strings",
"binary": "binary buffers",
"binary": "binary buffers"
},
"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.",
"timeout-tip": "Tip: In timeout mode timeout starts from arrival of first character.",
"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",
"never-get": "should never get here",
"serial-port": "serial port",
"error": "error",
"unexpected-close": "closed unexpectedly",
"opened": "opened at",
"baud": "baud",
"gone-away": "gone away",
"closed": "closed"
"error": "serial port __port__ error: __error__",
"unexpected-close": "serial port __port__ closed unexpectedly",
"disconnected": "serial port __port__ disconnected",
"closed": "serial port __port__ closed"
}
},
"tcpin": {
@ -317,52 +324,52 @@
"output": "Output",
"port": "port",
"host": "at host",
"a": "a",
"payload": "payload(s)",
"delimited": "delimited by",
"close-connection": "Close connection after each message is sent ?",
"decode-base64": "Decode Base64 message ?",
"close-connection": "Close connection after each message is sent?",
"decode-base64": "Decode Base64 message?",
"server": "Server",
"return": "Return",
"numberph": "number"
"return": "Return"
},
"type": {
"listen": "Listen on",
"connect": "Connect to",
"reply": "Reply to TCP",
"reply": "Reply to TCP"
},
"output": {
"stream": "stream of",
"single": "single",
"buffer": "Buffer",
"string": "String",
"base64": "Base64 String",
"base64": "Base64 String"
},
"return": {
"timeout": "after a fixed timeout of",
"character": "when character received is",
"number": "a fixed number of characters",
"never": "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.",
"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.",
"errors": {
"connecting-to": "connecting to",
"connected-to": "connected to",
"connection-lost": "connection lost to",
"timeout": "timeout closed socket port",
"listening-port": "listening on port",
"number": "a fixed number of chars:",
"never": "keep connection open"
},
"status": {
"connecting": "connecting to __host__:__port__",
"connected": "connected to __host__:__port__",
"listening-port": "listening on port __port__",
"stopped-listening": "stopped listening on port",
"error": "error",
"connection-from": "connection from",
"connection-closed": "connection closed from",
"socket-error": "socket error from",
"client-connected": "client connected",
"data": "data:",
"client-disconnected": "client disconnected",
"connection-from": "connection from __host__:__port__",
"connection-closed": "connection closed from __host__:__port__"
},
"errors": {
"connection-lost": "connection lost to __host__:__port__",
"timeout": "timeout closed socket port __port__",
"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",
"timeout": "connect timeout",
"cannot-listen": "unable to listen on port",
"connect-timeout": "connect timeout",
"connect-fail": "connect failed"
}
},
"udp": {
"udp": "udp",
"label": {
"listen": "Listen for",
"onport": "on Port",
@ -377,7 +384,7 @@
"toportph": "port",
"address": "Address",
"addressph": "destination ip",
"decode-base64": "Decode Base64 encoded payload ?",
"decode-base64": "Decode Base64 encoded payload?",
"outportph": "port"
},
"udpmsgs": "udp messages",
@ -412,19 +419,32 @@
}
},
"switch": {
"switch": "switch",
"label": {
"rule": "rule",
"switchlabel": "switch"
"property": "Property",
"rule": "rule"
},
"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",
"label": {
"rules": "Rules",
"rule": "rule"
"rule": "rule",
"set": "set __property__",
"change": "change __property__",
"delete": "delete __property__",
"changeCount": "change: __count__ rules"
},
"set": "Set",
"change": "Change",
@ -434,26 +454,28 @@
"replace": "Replace with",
"regex": "Use regular expressions",
"errors": {
"invalid-from": "Invalid 'from' property:"
"invalid-from": "Invalid 'from' property: __error__"
}
},
"range": {
"range": "range",
"label": {
"action": "Action",
"inputrange": "Map the input range",
"resultrange": "to the result range",
"from": "from",
"to": "to",
"eg0ph": "e.g. 0",
"eg99ph": "e.g. 99",
"eg255ph": "e.g. 255",
"roundresult": "Round result to the nearest integer?",
"rangelabel": "range"
"roundresult": "Round result to the nearest integer?"
},
"placeholder": {
"min": "e.g. 0",
"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.",
"errors": {
"notnumber": "Not a number"
@ -463,7 +485,6 @@
"csv": "csv",
"label": {
"columns": "Columns",
"columnsph": "comma-separated column names",
"separator": "Separator",
"c2o": "CSV-to-Object options",
"o2c": "Object-to-CSV options",
@ -473,42 +494,53 @@
"includerow": "include column name row",
"newline": "Newline"
},
"placeholder": {
"columns": "comma-separated column names"
},
"separator": {
"comma": "comma",
"tab": "tab",
"space": "space",
"semicolon": "semicolon",
"colon": "colon",
"hashtag": "hashtag",
"other": "other...",
"other": "other..."
},
"output": {
"row": "a message per row",
"array": "a single message [array]",
"array": "a single message [array]"
},
"newline": {
"linux": "Linux (\\n)",
"mac": "Mac (\\r)",
"windows": "Windows (\\r\\n)",
"windows": "Windows (\\r\\n)"
},
"errors": {
"csv_js": "This node only handles csv strings or js objects."
}
},
"html": {
"html": "html",
"label": {
"select": "Select",
"output": "Output"
},
"htmlcontent": "the html content of the elements",
"textcontent": "only the text content of the elements",
"output": {
"html": "the html content of the elements",
"text": "only the text content of the elements"
},
"format": {
"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."
},
"json": {
"json": "json",
"errors": {
"dropped": "Dropped"
"dropped-object": "Ignored non-object payload",
"dropped": "Ignored unsupported payload type"
}
},
"xml": {
"xml": "xml",
"label": {
"represent": "Represent XML tag attributes as a property named",
"prefix": "Prefix to access character content",
@ -519,9 +551,6 @@
"xml_js": "This node only handles xml strings or js objects."
}
},
"sentiment": {
"sentiment": "sentiment"
},
"arduino": {
"arduino": "arduino",
"label": {
@ -557,10 +586,10 @@
"label": {
"gpiopin": "GPIO Pin",
"selectpin": "select pin",
"registor": "Registor ?",
"readinitial": "Read initial state of pin on deploy/restart ?",
"registor": "Registor?",
"readinitial": "Read initial state of pin on deploy/restart?",
"type": "Type",
"initpin": "Initialise pin state ?",
"initpin": "Initialise pin state?",
"button": "Button",
"pimouse": "Pi Mouse",
"left": "Left",
@ -613,7 +642,7 @@
"label": {
"filename": "Filename",
"filenameph": "filename",
"splitlines": "Split lines if we see \\n ?"
"splitlines": "Split lines if we see \\n?"
},
"errors": {
"windowsnotsupport": "Info : Currently not supported on Windows."
@ -625,7 +654,7 @@
"filename": "Filename",
"filenameph": "filename",
"action": "Action",
"addnewline": "Add newline (\\n) to each payload ?",
"addnewline": "Add newline (\\n) to each payload?",
"outputas": "Ourput as",
"filelabel": "file",
"deletelabel": "delete"
@ -750,8 +779,8 @@
"action": "Action",
"port": "Port",
"portph": "port",
"ssl": "Use Secure SSL connection ?",
"self": "Allow self-signed certificates ?",
"ssl": "Use Secure SSL connection?",
"self": "Allow self-signed certificates?",
"nickname": "Nickname"
},
"payload": "Send payload to channel(s)",
@ -769,7 +798,7 @@
"ping": "PING from",
"quit": "QUIT",
"restart": "restart",
"connectionlost": "CONNECTION LOST ?",
"connectionlost": "CONNECTION LOST?",
"hasjoined": "has joined",
"sentinvite": "sent invite to",
"hasleft": "has left",

View File

@ -20,7 +20,7 @@
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
<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 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;">
@ -61,7 +61,7 @@
outputs: 1,
icon: "switch.png",
label: function() {
return this.name||this._("switch.label.switchlabel");
return this.name||"switch";
},
oneditprepare: function() {
@ -72,14 +72,14 @@
{v:"lte",t:"<="},
{v:"gt",t:">"},
{v:"gte",t:">="},
{v:"btwn",t:"is between"},
{v:"cont",t:"contains"},
{v:"regex",t:"matches regex"},
{v:"true",t:"is true"},
{v:"false",t:"is false"},
{v:"null",t:"is null"},
{v:"nnull",t:"is not null"},
{v:"else",t:"otherwise"}
{v:"btwn",t:this._("switch.rules.btwn")},
{v:"cont",t:this._("switch.rules.cont")},
{v:"regex",t:this._("switch.rules.regex")},
{v:"true",t:this._("switch.rules.true")},
{v:"false",t:this._("switch.rules.false")},
{v:"null",t:this._("switch.rules.null")},
{v:"nnull",t:this._("switch.rules.nnull")},
{v:"else",t:this._("switch.rules.else")}
];
function generateRule(i,rule) {

View File

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

View File

@ -52,7 +52,7 @@ module.exports = function(RED) {
rule.from = new RegExp(rule.from, "g");
} catch (e) {
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">
<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;">
<option value="scale" data-i18n="range.scale-payload"></option>
<option value="clamp" data-i18n="range.scale-limit"></option>
<option value="roll" data-i18n="range.scale-wrap"></option>
<option value="scale" data-i18n="range.scale.payload"></option>
<option value="clamp" data-i18n="range.scale.limit"></option>
<option value="roll" data-i18n="range.scale.wrap"></option>
</select>
</div>
<br/>
<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>
<span data-i18n="range.label.from"></span>: <input type="text" id="node-input-minin" data-i18n="[placeholder]range.label.eg0ph" 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;"/>
<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.placeholder.maxin" style="width:100px;"/>
</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>
<span data-i18n="range.label.from"></span>: <input type="text" id="node-input-minout" data-i18n="[placeholder]range.label.eg0ph" 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;"/>
<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.placeholder.maxout" style="width:100px;"/>
</div>
<br/>
<div class="form-row"><label></label>
@ -72,7 +72,7 @@
outputs: 1,
icon: "range.png",
label: function() {
return this.name || this._("range.label.rangelabel");
return this.name || "range";
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";

View File

@ -18,18 +18,18 @@
<script type="text/x-red" data-template-name="csv">
<div class="form-row">
<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 class="form-row">
<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">
<option value="," data-i18n="csv.comma"></option>
<option value="\t" data-i18n="csv.tab"></option>
<option value=" " data-i18n="csv.space"></option>
<option value=";" data-i18n="csv.semicolon"></option>
<option value=":" data-i18n="csv.colon"></option>
<option value="#" data-i18n="csv.hashtag"></option>
<option value="" data-i18n="csv.other"></option>
<option value="," data-i18n="csv.separator.comma"></option>
<option value="\t" data-i18n="csv.separator.tab"></option>
<option value=" " data-i18n="csv.separator.space"></option>
<option value=";" data-i18n="csv.separator.semicolon"></option>
<option value=":" data-i18n="csv.separator.colon"></option>
<option value="#" data-i18n="csv.separator.hashtag"></option>
<option value="" data-i18n="csv.separator.other"></option>
</select>
<input style="width: 40px;" type="text" id="node-input-sep" pattern=".">
</div>
@ -47,8 +47,8 @@
<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>
<select type="text" id="node-input-multi" style="width: 250px;">
<option value="one" data-i18n="csv.row"></option>
<option value="mult" data-i18n="csv.array"></option>
<option value="one" data-i18n="csv.output.row"></option>
<option value="mult" data-i18n="csv.output.array"></option>
</select>
</div>
<hr align="middle"/>
@ -60,9 +60,9 @@
<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>
<select style="width: 150px" id="node-input-ret">
<option value='\n' data-i18n="csv.linux"></option>
<option value='\r' data-i18n="csv.mac"></option>
<option value='\r\n' data-i18n="csv.windows"></option>
<option value='\n' data-i18n="csv.newline.linux"></option>
<option value='\r' data-i18n="csv.newline.mac"></option>
<option value='\r\n' data-i18n="csv.newline.windows"></option>
</select>
</div>
</script>

View File

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

View File

@ -35,9 +35,9 @@ module.exports = function(RED) {
msg.payload = JSON.stringify(msg.payload);
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.
});

View File

@ -105,13 +105,13 @@ describe('JSON node', function() {
//console.log(logEvents);
logEvents.should.have.length(4);
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].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].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].msg.toString().should.startWith('json.errors.dropped: ');
logEvents[3][0].msg.toString().should.eql('json.errors.dropped-object');
done();
} catch(err) {
done(err);

View File

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