mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
i18n enable runtime node files
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013, 2014 IBM Corp.
|
||||
* Copyright 2013, 2015 IBM Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,12 +32,12 @@ module.exports = function(RED) {
|
||||
|
||||
if (this.repeat && !isNaN(this.repeat) && this.repeat > 0) {
|
||||
this.repeat = this.repeat * 1000;
|
||||
if (RED.settings.verbose) { this.log("repeat = "+this.repeat); }
|
||||
if (RED.settings.verbose) { this.log(RED._("inject.repeat",this)); }
|
||||
this.interval_id = setInterval( function() {
|
||||
node.emit("input",{});
|
||||
}, this.repeat );
|
||||
} else if (this.crontab) {
|
||||
if (RED.settings.verbose) { this.log("crontab = "+this.crontab); }
|
||||
if (RED.settings.verbose) { this.log(RED._("inject.crontab",this)); }
|
||||
this.cronjob = new cron.CronJob(this.crontab,
|
||||
function() {
|
||||
node.emit("input",{});
|
||||
@@ -68,10 +68,10 @@ module.exports = function(RED) {
|
||||
InjectNode.prototype.close = function() {
|
||||
if (this.interval_id != null) {
|
||||
clearInterval(this.interval_id);
|
||||
if (RED.settings.verbose) { this.log("inject: repeat stopped"); }
|
||||
if (RED.settings.verbose) { this.log(RED._("inject.stopped")); }
|
||||
} else if (this.cronjob != null) {
|
||||
this.cronjob.stop();
|
||||
if (RED.settings.verbose) { this.log("inject: cronjob stopped"); }
|
||||
if (RED.settings.verbose) { this.log(RED._("inject.stopped")); }
|
||||
delete this.cronjob;
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ module.exports = function(RED) {
|
||||
res.send(200);
|
||||
} catch(err) {
|
||||
res.send(500);
|
||||
node.error("Inject failed:"+err);
|
||||
node.error(RED._("inject.failed",{error:err}));
|
||||
}
|
||||
} else {
|
||||
res.send(404);
|
||||
|
8
nodes/core/locales/en-US/messages.json
Normal file
8
nodes/core/locales/en-US/messages.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"inject": {
|
||||
"repeat": "repeat = __repeat__",
|
||||
"crontab": "crontab = __crontab__",
|
||||
"stopped": "stopped",
|
||||
"failed": "Inject failed: __error__"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user