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

[groups] i18n group messages

This commit is contained in:
Nick O'Leary 2020-03-26 22:50:46 +00:00
parent 13830ffc9c
commit 94ef25bbb9
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 18 additions and 11 deletions

View File

@ -16,7 +16,9 @@
"clone": "Clone project",
"cont": "Continue",
"line": "Outline",
"fill": "Fill"
"fill": "Fill",
"color": "Color",
"position": "Position"
},
"type": {
"string": "string",
@ -320,6 +322,13 @@
"multipleInputsToSelection": "<strong>Cannot create subflow</strong>: multiple inputs to selection"
}
},
"group": {
"editGroup": "Edit group: __name__",
"errors": {
"cannotCreateDiffGroups": "Cannot create group using nodes from different groups",
"cannotAddSubflowPorts": "Cannot add subflow ports to a group"
}
},
"editor": {
"configEdit": "Edit",
"configAdd": "Add",

View File

@ -515,7 +515,7 @@ RED.editor = (function() {
var node = editStack[i];
label = node.type;
if (node.type === 'group') {
label = RED._("subflow.editGroup",{name:RED.utils.sanitize(node.name||node.id)});
label = RED._("group.editGroup",{name:RED.utils.sanitize(node.name||node.id)});
} else if (node.type === '_expression') {
label = RED._("expressionEditor.title");
} else if (node.type === '_js') {

View File

@ -39,12 +39,12 @@ RED.group = (function() {
'<div style="margin-left: 100px; display: inline-block">'+
'<div class="form-row">'+
'<span style="display: inline-block; min-width: 140px" id="node-input-row-style-label-color">'+
'<label style="width: 70px;margin-right: 10px" for="node-input-style-fill">Color</label>'+
'<label style="width: 70px;margin-right: 10px" for="node-input-style-fill" data-i18n="editor:common.label.color"></label>'+
'</span>'+
'</div>'+
'<div class="form-row">'+
'<span style="display: inline-block; min-width: 140px;" id="node-input-row-style-label-position">'+
'<label style="width: 70px;margin-right: 10px " for="node-input-style-label-position">Position</label>'+
'<label style="width: 70px;margin-right: 10px " for="node-input-style-label-position" data-i18n="editor:common.label.position"></label>'+
'</span>'+
'</div>'+
'</div>'+
@ -340,7 +340,7 @@ RED.group = (function() {
if (i === 0) {
parentGroup = n.g;
} else if (n.g !== parentGroup) {
RED.notify("Cannot merge nodes from different groups","error");
RED.notify(RED._("group.errors.cannotCreateDiffGroups"),"error");
return;
}
}
@ -404,7 +404,7 @@ RED.group = (function() {
return;
}
if (nodes.filter(function(n) { return n.type === "subflow" }).length > 0) {
RED.notify("Cannot add subflow ports to a group","error");
RED.notify(RED._("group.errors.cannotAddSubflowPorts"),"error");
return;
}
// nodes is an array
@ -446,7 +446,7 @@ RED.group = (function() {
if (!z) {
z = n.z;
} else if (z !== n.z) {
throw new Error("Cannot create group using nodes with different z properties")
throw new Error("Cannot add nooes with different z properties")
}
if (n.g) {
// This is already in a group.
@ -454,13 +454,13 @@ RED.group = (function() {
if (!g) {
if (i!==0) {
// TODO: this might be ok when merging groups
throw new Error("Cannot create group using nodes from different groups")
throw new Error(RED._("group.errors.cannotCreateDiffGroups"))
}
g = n.g
}
}
if (g !== n.g) {
throw new Error("Cannot create group using nodes from different groups")
throw new Error(RED._("group.errors.cannotCreateDiffGroups"))
}
}
// The nodes are already in a group. The assumption is they should be
@ -495,7 +495,6 @@ RED.group = (function() {
markDirty(group);
}
function removeFromGroup(group, nodes, reparent) {
console.log('rfg',group,nodes);
if (!Array.isArray(nodes)) {
nodes = [nodes];
}
@ -504,7 +503,6 @@ RED.group = (function() {
// TODO: DRY mergeSelection,removeSelection,...
for (var i=0; i<nodes.length; i++) {
if (nodes[i].g !== group.id) {
RED.notify("Cannot remove node "+nodes[i].id+" from group it isn't in");
return;
}
}