Updated the notifications and errors to use NLS

removed errant comma
This commit is contained in:
Allen Boone 2015-05-20 16:08:20 -04:00 committed by Nick O'Leary
parent a39a26fcc2
commit 0017074d38
4 changed files with 30 additions and 14 deletions

View File

@ -81,7 +81,7 @@ RED.comms = (function() {
};
ws.onclose = function() {
if (errornotification == null) {
errornotification = RED.notify("<b>Error</b>: Lost connection to server","error",true);
errornotification = RED.notify(RED._("notification.lostConnectionError"),"error",true);
} else if (clearErrorTimer) {
clearTimeout(clearErrorTimer);
clearErrorTimer = null;

View File

@ -118,7 +118,7 @@ RED.nodes = (function() {
},
removeNodeType: function(nt) {
if (nt.substring(0,8) != "subflow:") {
throw new Error("this api is subflow only. called with:",nt);
throw new Error(RED._("error.apiSubflowOnly"),nt);
}
delete nodeDefinitions[nt];
RED.palette.remove(nt);
@ -543,7 +543,7 @@ RED.nodes = (function() {
try {
newNodes = JSON.parse(newNodesObj);
} catch(err) {
var e = new Error("Invalid flow: "+err.message);
var e = new Error(RED._("error.invalidFlow")+err.message);
e.code = "NODE_RED";
throw e;
}
@ -571,7 +571,7 @@ RED.nodes = (function() {
if (unknownTypes.length > 0) {
var typeList = "<ul><li>"+unknownTypes.join("</li><li>")+"</li></ul>";
var type = "type"+(unknownTypes.length > 1?"s":"");
RED.notify("<strong>Imported unrecognised "+type+":</strong>"+typeList,"error",false,10000);
RED.notify("<strong>"+RED._("notification.importUnrecognised")+type+":</strong>"+typeList,"error",false,10000);
//"DO NOT DEPLOY while in this state.<br/>Either, add missing types to Node-RED, restart and then reload page,<br/>or delete unknown "+n.name+", rewire as required, and then deploy.","error");
}
@ -584,10 +584,10 @@ RED.nodes = (function() {
var subflowId = m[1];
var err;
if (subflowId === activeSubflow.id) {
err = new Error("Cannot add subflow to itself");
err = new Error(RED._("error.cannotAddSubflowToItself"));
}
if (subflowContains(m[1],activeSubflow.id)) {
err = new Error("Cannot add subflow - circular reference detected");
err = new Error(RED._("error.cannotAddCircularReference"));
}
if (err) {
// TODO: standardise error codes

View File

@ -72,9 +72,9 @@ RED.user = (function() {
}
row.appendTo("#node-dialog-login-fields");
}
$('<div class="form-row" style="text-align: right; margin-top: 10px;"><span id="node-dialog-login-failed" style="line-height: 2em;float:left;" class="hide">Login failed</span><img src="red/images/spin.svg" style="height: 30px; margin-right: 10px; " class="login-spinner hide"/>'+
(opts.cancelable?'<a href="#" id="node-dialog-login-cancel" style="margin-right: 20px;" tabIndex="'+(i+1)+'">Cancel</a>':'')+
'<input type="submit" id="node-dialog-login-submit" style="width: auto;" tabIndex="'+(i+2)+'" value="Login"></div>').appendTo("#node-dialog-login-fields");
$('<div class="form-row" style="text-align: right; margin-top: 10px;"><span id="node-dialog-login-failed" style="line-height: 2em;float:left;" class="hide">'+RED._("dialog.loginFailed")+'</span><img src="red/images/spin.svg" style="height: 30px; margin-right: 10px; " class="login-spinner hide"/>'+
(opts.cancelable?'<a href="#" id="node-dialog-login-cancel" style="margin-right: 20px;" tabIndex="'+(i+1)+'">'+RED._("dialog.cancel")+'</a>':'')+
'<input type="submit" id="node-dialog-login-submit" style="width: auto;" tabIndex="'+(i+2)+'" value="'+RED._("dialog.login")+'"></div>').appendTo("#node-dialog-login-fields");
$("#node-dialog-login-submit").button();
@ -137,11 +137,11 @@ RED.user = (function() {
if (RED.settings.user.anonymous) {
RED.menu.addItem("btn-usermenu",{
id:"usermenu-item-login",
label:"Login",
label:RED._("menu.label.login"),
onselect: function() {
RED.user.login({cancelable:true},function() {
RED.settings.load(function() {
RED.notify("Logged in as "+RED.settings.user.username,"success");
RED.notify(RED._("notification.loggedInAs")+RED.settings.user.username,"success");
updateUserMenu();
});
});
@ -154,7 +154,7 @@ RED.user = (function() {
});
RED.menu.addItem("btn-usermenu",{
id:"usermenu-item-logout",
label:"Logout",
label:RED._("menu.label.logout"),
onselect: function() {
RED.user.logout();
}

View File

@ -20,7 +20,9 @@
"add": "Add",
"rename": "Rename",
"delete": "Delete",
"keyboardShortcuts": "Keyboard Shortcuts"
"keyboardShortcuts": "Keyboard Shortcuts",
"login": "Login",
"logout": "Logout"
}
},
"notification": {
@ -31,6 +33,20 @@
"nodeEnabled": "Node enabled:",
"nodeEnabled_plural": "Nodes enabled:",
"nodeDisabled": "Node disabled:",
"nodeDisabled_plural": "Nodes disabled:"
"nodeDisabled_plural": "Nodes disabled:",
"lostConnectionError": "<b>Error</b>: Lost connection to server",
"importUnrecognised": "Imported unrecognised ",
"loggedInAs": "Logged in as "
},
"error": {
"apiSubflowOnly": "this api is subflow only. called with:",
"invalidFlow": "Invalid flow: ",
"cannotAddSubflowToItself": "Cannot add subflow to itself",
"cannotAddCircularReference": "Cannot add subflow - circular reference detected"
},
"dialog": {
"cancel": "Cancel",
"login": "Login",
"loginFailed": "Login failed"
}
}