'+
'
'+
'
'+
@@ -77,16 +77,17 @@ RED.palette = (function() {
if (label != type) {
l = "
"+label+"
"+type+"
";
}
-
- popOverContent = $(l+($("script[data-help-name|='"+type+"']").html()||"
no information available
").trim())
+
+ popOverContent = $(l+($("script[data-help-name|='"+type+"']").html()||"
"+RED._("palette.noInfo")+"
").trim())
.filter(function(n) {
return this.nodeType == 1 || (this.nodeType == 3 && this.textContent.trim().length > 0)
}).slice(0,2);
} catch(err) {
// Malformed HTML may cause errors. TODO: need to understand what can break
- console.log("Error generating pop-over label for '"+type+"'.");
+ // NON-NLS: internal debug
+ console.log("Error generating pop-over label for ",type);
console.log(err.toString());
- popOverContent = "
"+label+"
no information available
";
+ popOverContent = "
"+label+"
"+RED._("palette.noInfo")+"
";
}
@@ -120,12 +121,12 @@ RED.palette = (function() {
label = (typeof def.paletteLabel === "function" ? def.paletteLabel.call(def) : def.paletteLabel)||"";
}
-
+
$('
',{class:"palette_label"+(def.align=="right"?" palette_label_right":"")}).appendTo(d);
d.className="palette_node";
-
-
+
+
if (def.icon) {
var icon_url = (typeof def.icon === "function" ? def.icon.call({}) : def.icon);
var iconContainer = $('
',{class:"palette_icon_container"+(def.align=="right"?" palette_icon_container_right":"")}).appendTo(d);
@@ -147,7 +148,12 @@ RED.palette = (function() {
}
if ($("#palette-base-category-"+rootCategory).length === 0) {
- createCategoryContainer(rootCategory);
+ if(core.indexOf(rootCategory) !== -1){
+ createCategoryContainer(rootCategory, RED._("node-red:palette.label."+rootCategory, {defaultValue:rootCategory}));
+ } else {
+ var ns = def.set.id;
+ createCategoryContainer(rootCategory, RED._(ns+":palette.label."+rootCategory, {defaultValue:rootCategory}));
+ }
}
$("#palette-container-"+rootCategory).show();
@@ -178,7 +184,7 @@ RED.palette = (function() {
revertDuration: 50,
start: function() {RED.view.focus();}
});
-
+
if (def.category == "subflows") {
$(d).dblclick(function(e) {
RED.workspaces.show(nt.substring(8));
@@ -187,7 +193,7 @@ RED.palette = (function() {
}
setLabel(nt,$(d),label);
-
+
var categoryNode = $("#palette-container-"+category);
if (categoryNode.find(".palette_node").length === 1) {
if (!categoryNode.find("i").hasClass("expanded")) {
@@ -195,7 +201,7 @@ RED.palette = (function() {
categoryNode.find("i").toggleClass("expanded");
}
}
-
+
}
}
@@ -268,30 +274,34 @@ RED.palette = (function() {
function init() {
$(".palette-spinner").show();
if (RED.settings.paletteCategories) {
- RED.settings.paletteCategories.forEach(createCategoryContainer);
+ RED.settings.paletteCategories.forEach(function(category){
+ createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category}));
+ });
} else {
- core.forEach(createCategoryContainer);
+ core.forEach(function(category){
+ createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category}));
+ });
}
-
+
$("#palette-search-input").focus(function(e) {
RED.keyboard.disable();
});
$("#palette-search-input").blur(function(e) {
RED.keyboard.enable();
});
-
+
$("#palette-search-clear").on("click",function(e) {
e.preventDefault();
$("#palette-search-input").val("");
filterChange();
$("#palette-search-input").focus();
});
-
+
$("#palette-search-input").val("");
$("#palette-search-input").on("keyup",function() {
filterChange();
});
-
+
$("#palette-search-input").on("focus",function() {
$("body").one("mousedown",function() {
$("#palette-search-input").blur();
diff --git a/editor/js/ui/sidebar.js b/editor/js/ui/sidebar.js
index 6e94a8ab0..e6f93a5f7 100644
--- a/editor/js/ui/sidebar.js
+++ b/editor/js/ui/sidebar.js
@@ -30,7 +30,8 @@ RED.sidebar = (function() {
function addTab(title,content,closeable) {
$("#sidebar-content").append(content);
$(content).hide();
- sidebar_tabs.addTab({id:"tab-"+title,label:title,closeable:closeable});
+ var id = content.id || "tab-"+title.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, "\\$1" );
+ sidebar_tabs.addTab({id:id,label:title,closeable:closeable});
//content.style.position = "absolute";
//$('#sidebar').tabs("refresh");
}
diff --git a/editor/js/ui/subflow.js b/editor/js/ui/subflow.js
index 1a49974da..dea5169c9 100644
--- a/editor/js/ui/subflow.js
+++ b/editor/js/ui/subflow.js
@@ -15,12 +15,12 @@
**/
RED.subflow = (function() {
-
+
function getSubflow() {
return RED.nodes.subflow(RED.workspaces.active());
}
-
+
function findAvailableSubflowIOPosition(subflow) {
var pos = {x:70,y:70};
for (var i=0;i
Cannot create subflow: no nodes selected","error");
+ RED.notify(RED._("subflow.errors.noNodesSelected"),"error");
return;
}
var i;
var nodes = {};
var new_links = [];
var removedLinks = [];
-
+
var candidateInputs = [];
var candidateOutputs = [];
-
+
var boundingBox = [selection.nodes[0].x,
selection.nodes[0].y,
selection.nodes[0].x,
selection.nodes[0].y];
-
+
for (i=0;i 1) {
- RED.notify("Cannot create subflow: multiple inputs to selection","error");
+ RED.notify(RED._("subflow.errors.multipleInputsToSelection"),"error");
return;
}
//if (candidateInputs.length == 0) {
// RED.notify("Cannot create subflow: no input to selection","error");
// return;
//}
-
-
+
+
var lastIndex = 0;
RED.nodes.eachSubflow(function(sf) {
var m = (new RegExp("^Subflow (\\d+)$")).exec(sf.name);
@@ -292,9 +292,9 @@ RED.subflow = (function() {
lastIndex = Math.max(lastIndex,m[1]);
}
});
-
+
var name = "Subflow "+(lastIndex+1);
-
+
var subflowId = RED.nodes.id();
var subflow = {
type:"subflow",
@@ -322,7 +322,7 @@ RED.subflow = (function() {
}})
};
RED.nodes.addSubflow(subflow);
-
+
var subflowInstance = {
id:RED.nodes.id(),
type:"subflow:"+subflow.id,
@@ -337,13 +337,13 @@ RED.subflow = (function() {
subflowInstance._def = RED.nodes.getType(subflowInstance.type);
RED.editor.validateNode(subflowInstance);
RED.nodes.add(subflowInstance);
-
+
candidateInputs.forEach(function(l) {
var link = {source:l.source, sourcePort:l.sourcePort, target: subflowInstance};
new_links.push(link);
RED.nodes.addLink(link);
});
-
+
candidateOutputs.forEach(function(output,i) {
output.targets.forEach(function(target) {
var link = {source:subflowInstance, sourcePort:i, target: target};
@@ -351,7 +351,7 @@ RED.subflow = (function() {
RED.nodes.addLink(link);
});
});
-
+
subflow.in.forEach(function(input) {
input.wires.forEach(function(wire) {
var link = {source: input, sourcePort: 0, target: RED.nodes.node(wire.id) }
@@ -366,34 +366,34 @@ RED.subflow = (function() {
RED.nodes.addLink(link);
});
});
-
+
for (i=0;i",{class:"tab-config-list"}).appendTo(content);
-
+
function show() {
if (!RED.sidebar.containsTab("config")) {
- RED.sidebar.addTab("config",content,true);
+ RED.sidebar.addTab(RED._("sidebar.config.title"),content,true);
}
refresh();
RED.sidebar.show("config");
}
-
+
function refresh() {
list.empty();
RED.nodes.eachConfig(function(node) {
@@ -46,12 +46,12 @@ RED.sidebar.config = (function() {
label = node._def.label;
}
label = label || " ";
-
+
var entry = $('').appendTo(li);
entry.on('dblclick',function(e) {
RED.editor.editConfig("", node.type, node.id);
});
-
+
var userArray = node.users.map(function(n) { return n.id });
entry.on('mouseover',function(e) {
RED.nodes.eachNode(function(node) {
@@ -72,7 +72,7 @@ RED.sidebar.config = (function() {
});
RED.view.redraw();
});
-
+
$(''+label+'
').appendTo(entry);
$(''+node.users.length+'
').appendTo(entry);
});
diff --git a/editor/js/ui/tab-info.js b/editor/js/ui/tab-info.js
index c5f62c5c9..c07a3c266 100644
--- a/editor/js/ui/tab-info.js
+++ b/editor/js/ui/tab-info.js
@@ -33,10 +33,10 @@ RED.sidebar.info = (function() {
content.style.paddingRight = "4px";
var propertiesExpanded = false;
-
+
function show() {
if (!RED.sidebar.containsTab("info")) {
- RED.sidebar.addTab("info",content,false);
+ RED.sidebar.addTab(RED._("sidebar.info.title"),content,false);
}
RED.sidebar.show("info");
}
@@ -60,13 +60,13 @@ RED.sidebar.info = (function() {
function refresh(node) {
var table = '';
- table += 'Node |
';
+ table += ''+RED._("sidebar.info.node")+' |
';
if (node.type != "subflow" && node.name) {
- table += "Name | "+node.name+" |
";
+ table += ""+RED._("common.label.name")+" | "+node.name+" |
";
}
- table += "Type | "+node.type+" |
";
- table += "ID | "+node.id+" |
";
-
+ table += ""+RED._("sidebar.info.type")+" | "+node.type+" |
";
+ table += ""+RED._("sidebar.info.id")+" | "+node.id+" |
";
+
var m = /^subflow(:(.+))?$/.exec(node.type);
if (m) {
var subflowNode;
@@ -75,9 +75,9 @@ RED.sidebar.info = (function() {
} else {
subflowNode = node;
}
-
- table += 'Subflow |
';
-
+
+ table += ''+RED._("sidebar.info.subflow")+' |
';
+
var userCount = 0;
var subflowType = "subflow:"+subflowNode.id;
RED.nodes.eachNode(function(n) {
@@ -85,12 +85,12 @@ RED.sidebar.info = (function() {
userCount++;
}
});
- table += "name | "+subflowNode.name+" |
";
- table += "instances | "+userCount+" |
";
+ table += ""+RED._("common.label.name")+" | "+subflowNode.name+" |
";
+ table += ""+RED._("sidebar.info.instances")+" | "+userCount+" |
";
}
-
+
if (!m && node.type != "subflow" && node.type != "comment") {
- table += ' |
';
+ table += ' |
';
if (node._def) {
for (var n in node._def.defaults) {
if (n != "name" && node._def.defaults.hasOwnProperty(n)) {
@@ -98,7 +98,7 @@ RED.sidebar.info = (function() {
var type = typeof val;
if (type === "string") {
if (val.length === 0) {
- val += 'blank';
+ val += ''+RED._("sidebar.info.blank")+'';
} else {
if (val.length > 30) {
val = val.substring(0,30)+" ...";
@@ -114,14 +114,14 @@ RED.sidebar.info = (function() {
val += " "+i+": "+vv+"
";
}
if (node[n].length > 10) {
- val += " ... "+node[n].length+" items
";
+ val += " ... "+RED._("sidebar.info.arrayItems",{count:node[n].length})+"
";
}
val += "]";
} else {
val = JSON.stringify(val,jsonFilter," ");
val = val.replace(/&/g,"&").replace(//g,">");
}
-
+
table += ''+n+" | "+val+" |
";
}
}
@@ -140,7 +140,7 @@ RED.sidebar.info = (function() {
}
$("#tab-info").html(table);
-
+
$(".node-info-property-header").click(function(e) {
var icon = $(this).find("i");
if (icon.hasClass("fa-caret-right")) {
@@ -154,15 +154,15 @@ RED.sidebar.info = (function() {
$(".node-info-property-row").hide();
propertiesExpanded = false;
}
-
+
e.preventDefault();
});
}
-
+
function clear() {
$("#tab-info").html("");
}
-
+
RED.view.on("selection-changed",function(selection) {
if (selection.nodes) {
if (selection.nodes.length == 1) {
diff --git a/editor/js/ui/view.js b/editor/js/ui/view.js
index 41a3d7ad1..acd0897be 100644
--- a/editor/js/ui/view.js
+++ b/editor/js/ui/view.js
@@ -35,7 +35,7 @@ RED.view = (function() {
var activeSubflow = null;
var activeNodes = [];
var activeLinks = [];
-
+
var selected_link = null,
mousedown_link = null,
mousedown_node = null,
@@ -73,7 +73,7 @@ RED.view = (function() {
.on("mousedown", function() {
$(this).focus();
});
-
+
var vis = outer
.append('svg:g')
.on("dblclick.zoom", null)
@@ -233,9 +233,9 @@ RED.view = (function() {
function updateActiveNodes() {
var activeWorkspace = RED.workspaces.active();
-
+
activeNodes = RED.nodes.filterNodes({z:activeWorkspace});
-
+
activeLinks = RED.nodes.filterLinks({
source:{z:activeWorkspace},
target:{z:activeWorkspace}
@@ -253,15 +253,15 @@ RED.view = (function() {
}
var scrollStartLeft = chart.scrollLeft();
var scrollStartTop = chart.scrollTop();
-
+
activeSubflow = RED.nodes.subflow(event.workspace);
if (activeSubflow) {
$("#workspace-subflow-add-input").toggleClass("disabled",activeSubflow.in.length > 0);
}
-
+
RED.menu.setDisabled("menu-item-workspace-edit", activeSubflow);
RED.menu.setDisabled("menu-item-workspace-delete",RED.workspaces.count() == 1 || activeSubflow);
-
+
if (workspaceScrollPositions[event.workspace]) {
chart.scrollLeft(workspaceScrollPositions[event.workspace].left);
chart.scrollTop(workspaceScrollPositions[event.workspace].top);
@@ -283,7 +283,7 @@ RED.view = (function() {
updateActiveNodes();
redraw();
});
-
+
$('#btn-zoom-out').click(function() {zoomOut();});
$('#btn-zoom-zero').click(function() {zoomZero();});
$('#btn-zoom-in').click(function() {zoomIn();});
@@ -296,50 +296,50 @@ RED.view = (function() {
else { zoomIn(); }
}
});
-
+
// Handle nodes dragged from the palette
$("#chart").droppable({
accept:".palette_node",
drop: function( event, ui ) {
d3.event = event;
var selected_tool = ui.draggable[0].type;
-
+
var m = /^subflow:(.+)$/.exec(selected_tool);
-
+
if (activeSubflow && m) {
var subflowId = m[1];
if (subflowId === activeSubflow.id) {
- RED.notify("Error: Cannot add subflow to itself","error");
+ RED.notify(RED._("notification.error",{message: RED._("notification.errors.cannotAddSubflowToItself")}),"error");
return;
}
if (RED.nodes.subflowContains(m[1],activeSubflow.id)) {
- RED.notify("Error: Cannot add subflow - circular reference detected","error");
+ RED.notify(RED._("notification.error",{message: RED._("notification.errors.cannotAddCircularReference")}),"error");
return;
}
-
+
}
-
+
var mousePos = d3.touches(this)[0]||d3.mouse(this);
mousePos[1] += this.scrollTop;
mousePos[0] += this.scrollLeft;
mousePos[1] /= scaleFactor;
mousePos[0] /= scaleFactor;
-
+
var nn = { id:(1+Math.random()*4294967295).toString(16),x: mousePos[0],y:mousePos[1],w:node_width,z:RED.workspaces.active()};
-
+
nn.type = selected_tool;
nn._def = RED.nodes.getType(nn.type);
-
+
if (!m) {
nn.inputs = nn._def.inputs || 0;
nn.outputs = nn._def.outputs;
-
+
for (var d in nn._def.defaults) {
if (nn._def.defaults.hasOwnProperty(d)) {
nn[d] = nn._def.defaults[d].value;
}
}
-
+
if (nn._def.onadd) {
nn._def.onadd.call(nn);
}
@@ -348,7 +348,7 @@ RED.view = (function() {
nn.inputs = subflow.in.length;
nn.outputs = subflow.out.length;
}
-
+
nn.changed = true;
nn.h = Math.max(node_height,(nn.outputs||0) * 15);
RED.history.push({t:'add',nodes:[nn.id],dirty:RED.nodes.dirty()});
@@ -362,13 +362,13 @@ RED.view = (function() {
updateActiveNodes();
updateSelection();
redraw();
-
+
if (nn._def.autoedit) {
RED.editor.edit(nn);
}
}
});
-
+
RED.keyboard.add(/* z */ 90,{ctrl:true},function(){RED.history.pop();});
RED.keyboard.add(/* a */ 65,{ctrl:true},function(){selectAll();d3.event.preventDefault();});
RED.keyboard.add(/* = */ 187,{ctrl:true},function(){zoomIn();d3.event.preventDefault();});
@@ -652,7 +652,7 @@ RED.view = (function() {
}
});
}
-
+
selected_link = null;
updateSelection();
redraw();
@@ -693,17 +693,17 @@ RED.view = (function() {
}
var selection = {};
-
+
if (moving_set.length > 0) {
selection.nodes = moving_set.map(function(n) { return n.n;});
}
if (selected_link != null) {
selection.link = selected_link;
}
-
+
eventHandler.emit("selection-changed",selection);
}
-
+
function endKeyboardMove() {
var ns = [];
for (var i=0;i 0) {
for (var i=0;i 0 || removedSubflowOutputs.length > 0 || removedSubflowInputs.length > 0) {
RED.nodes.dirty(true);
@@ -856,7 +856,7 @@ RED.view = (function() {
}
}
clipboard = JSON.stringify(nns);
- RED.notify(nns.length+" node"+(nns.length>1?"s":"")+" copied");
+ RED.notify(RED._("clipboard.nodeCopied",{count:nns.length}));
}
}
@@ -1043,9 +1043,9 @@ RED.view = (function() {
redraw();
}
} else if (d.changed) {
- RED.notify("Warning: node has undeployed changes","warning");
+ RED.notify(RED._("notification.warning", {message:RED._("notification.warnings.undeployedChanges")}),"warning");
} else {
- RED.notify("Warning: node actions disabled within subflow","warning");
+ RED.notify(RED._("notification.warning", {message:RED._("notification.warnings.nodeActionDisabled")}),"warning");
}
d3.event.preventDefault();
}
@@ -1070,9 +1070,9 @@ RED.view = (function() {
// Don't bother redrawing nodes if we're drawing links
if (mouse_mode != RED.state.JOINING) {
-
+
var dirtyNodes = {};
-
+
if (activeSubflow) {
var subflowOutputs = vis.selectAll(".subflowoutput").data(activeSubflow.out,function(d,i){ return d.id;});
subflowOutputs.exit().remove();
@@ -1082,7 +1082,7 @@ RED.view = (function() {
d.h=40;
});
outGroup.append("rect").attr("class","subflowport").attr("rx",8).attr("ry",8).attr("width",40).attr("height",40)
- // TODO: This is exactly the same set of handlers used for regular nodes - DRY
+ // TODO: This is exactly the same set of handlers used for regular nodes - DRY
.on("mouseup",nodeMouseUp)
.on("mousedown",nodeMouseDown)
.on("touchstart",function(d) {
@@ -1094,7 +1094,7 @@ RED.view = (function() {
touchStartTime = setTimeout(function() {
showTouchMenu(obj,pos);
},touchLongPressTimeout);
- nodeMouseDown.call(this,d)
+ nodeMouseDown.call(this,d)
})
.on("touchend", function(d) {
clearTimeout(touchStartTime);
@@ -1105,7 +1105,7 @@ RED.view = (function() {
}
nodeMouseUp.call(this,d);
});
-
+
outGroup.append("rect").attr("class","port").attr("rx",3).attr("ry",3).attr("width",10).attr("height",10).attr("x",-5).attr("y",15)
.on("mousedown", function(d,i){portMouseDown(d,1,0);} )
.on("touchstart", function(d,i){portMouseDown(d,1,0);} )
@@ -1125,7 +1125,7 @@ RED.view = (function() {
d.h=40;
});
inGroup.append("rect").attr("class","subflowport").attr("rx",8).attr("ry",8).attr("width",40).attr("height",40)
- // TODO: This is exactly the same set of handlers used for regular nodes - DRY
+ // TODO: This is exactly the same set of handlers used for regular nodes - DRY
.on("mouseup",nodeMouseUp)
.on("mousedown",nodeMouseDown)
.on("touchstart",function(d) {
@@ -1137,7 +1137,7 @@ RED.view = (function() {
touchStartTime = setTimeout(function() {
showTouchMenu(obj,pos);
},touchLongPressTimeout);
- nodeMouseDown.call(this,d)
+ nodeMouseDown.call(this,d)
})
.on("touchend", function(d) {
clearTimeout(touchStartTime);
@@ -1148,7 +1148,7 @@ RED.view = (function() {
}
nodeMouseUp.call(this,d);
});
-
+
inGroup.append("rect").attr("class","port").attr("rx",3).attr("ry",3).attr("width",10).attr("height",10).attr("x",35).attr("y",15)
.on("mousedown", function(d,i){portMouseDown(d,0,i);} )
.on("touchstart", function(d,i){portMouseDown(d,0,i);} )
@@ -1157,9 +1157,9 @@ RED.view = (function() {
.on("mouseover",function(d,i) { var port = d3.select(this); port.classed("port_hovered",(mouse_mode!=RED.state.JOINING || mousedown_port_type !== 0 ));})
.on("mouseout",function(d,i) { var port = d3.select(this); port.classed("port_hovered",false);});
inGroup.append("svg:text").attr('class','port_label').attr('x',18).attr('y',20).style("font-size","10px").text("input");
-
-
-
+
+
+
subflowOutputs.each(function(d,i) {
if (d.dirty) {
var output = d3.select(this);
@@ -1183,7 +1183,7 @@ RED.view = (function() {
vis.selectAll(".subflowoutput").remove();
vis.selectAll(".subflowinput").remove();
}
-
+
var node = vis.selectAll(".nodegroup").data(activeNodes,function(d){return d.id});
node.exit().remove();
@@ -1318,7 +1318,7 @@ RED.view = (function() {
//icon.attr('class','node_icon_shade node_icon_shade_'+d._def.align);
//icon.attr('class','node_icon_shade_border node_icon_shade_border_'+d._def.align);
}
-
+
//if (d.inputs > 0 && d._def.align == null) {
// icon_shade.attr("width",35);
// icon.attr("transform","translate(5,0)");
@@ -1388,7 +1388,7 @@ RED.view = (function() {
var thisNode = d3.select(this);
//thisNode.selectAll(".centerDot").attr({"cx":function(d) { return d.w/2;},"cy":function(d){return d.h/2}});
thisNode.attr("transform", function(d) { return "translate(" + (d.x-d.w/2) + "," + (d.y-d.h/2) + ")"; });
-
+
if (mouse_mode != RED.state.MOVING_ACTIVE) {
thisNode.selectAll(".node")
.attr("width",function(d){return d.w})
@@ -1398,13 +1398,13 @@ RED.view = (function() {
;
//thisNode.selectAll(".node-gradient-top").attr("width",function(d){return d.w});
//thisNode.selectAll(".node-gradient-bottom").attr("width",function(d){return d.w}).attr("y",function(d){return d.h-30});
-
+
thisNode.selectAll(".node_icon_group_right").attr('transform', function(d){return "translate("+(d.w-30)+",0)"});
thisNode.selectAll(".node_label_right").attr('x', function(d){return d.w-38});
//thisNode.selectAll(".node_icon_right").attr("x",function(d){return d.w-d3.select(this).attr("width")-1-(d.outputs>0?5:0);});
//thisNode.selectAll(".node_icon_shade_right").attr("x",function(d){return d.w-30;});
//thisNode.selectAll(".node_icon_shade_border_right").attr("d",function(d){return "M "+(d.w-30)+" 1 l 0 "+(d.h-2)});
-
+
var inputPorts = thisNode.selectAll(".port_input");
if (d.inputs === 0 && !inputPorts.empty()) {
inputPorts.remove();
@@ -1419,13 +1419,13 @@ RED.view = (function() {
.on("mouseover",function(d) { var port = d3.select(this); port.classed("port_hovered",(mouse_mode!=RED.state.JOINING || mousedown_port_type != 1 ));})
.on("mouseout",function(d) { var port = d3.select(this); port.classed("port_hovered",false);})
}
-
+
var numOutputs = d.outputs;
var y = (d.h/2)-((numOutputs-1)/2)*13;
d.ports = d.ports || d3.range(numOutputs);
d._ports = thisNode.selectAll(".port_output").data(d.ports);
var output_group = d._ports.enter().append("g").attr("class","port_output");
-
+
output_group.append("rect").attr("class","port").attr("rx",3).attr("ry",3).attr("width",10).attr("height",10)
.on("mousedown",(function(){var node = d; return function(d,i){portMouseDown(node,0,i);}})() )
.on("touchstart",(function(){var node = d; return function(d,i){portMouseDown(node,0,i);}})() )
@@ -1433,7 +1433,7 @@ RED.view = (function() {
.on("touchend",(function(){var node = d; return function(d,i){portMouseUp(node,0,i);}})() )
.on("mouseover",function(d,i) { var port = d3.select(this); port.classed("port_hovered",(mouse_mode!=RED.state.JOINING || mousedown_port_type !== 0 ));})
.on("mouseout",function(d,i) { var port = d3.select(this); port.classed("port_hovered",false);});
-
+
d._ports.exit().remove();
if (d._ports) {
numOutputs = d.outputs || 1;
@@ -1461,7 +1461,7 @@ RED.view = (function() {
(d._def.align?' node_label_'+d._def.align:'')+
(d._def.labelStyle?' '+(typeof d._def.labelStyle == "function" ? d._def.labelStyle.call(d):d._def.labelStyle):'') ;
});
-
+
if (d._def.icon) {
icon = thisNode.select(".node_icon");
var current_url = icon.attr("xlink:href");
@@ -1482,27 +1482,27 @@ RED.view = (function() {
}
}
}
-
-
+
+
thisNode.selectAll(".node_tools").attr("x",function(d){return d.w-35;}).attr("y",function(d){return d.h-20;});
-
+
thisNode.selectAll(".node_changed")
.attr("x",function(d){return d.w-10})
.classed("hidden",function(d) { return !d.changed; });
-
+
thisNode.selectAll(".node_error")
.attr("x",function(d){return d.w-10-(d.changed?13:0)})
.classed("hidden",function(d) { return d.valid; });
-
+
thisNode.selectAll(".port_input").each(function(d,i) {
var port = d3.select(this);
port.attr("transform",function(d){return "translate(-5,"+((d.h/2)-5)+")";})
});
-
+
thisNode.selectAll(".node_icon").attr("y",function(d){return (d.h-d3.select(this).attr("height"))/2;});
thisNode.selectAll(".node_icon_shade").attr("height",function(d){return d.h;});
thisNode.selectAll(".node_icon_shade_border").attr("d",function(d){ return "M "+(("right" == d._def.align) ?0:30)+" 1 l 0 "+(d.h-2)});
-
+
thisNode.selectAll('.node_button').attr("opacity",function(d) {
return (activeSubflow||d.changed)?0.4:1
});
@@ -1522,11 +1522,11 @@ RED.view = (function() {
}
return 1;
});
-
+
//thisNode.selectAll('.node_right_button').attr("transform",function(d){return "translate("+(d.w - d._def.button.width.call(d))+","+0+")";}).attr("fill",function(d) {
// return typeof d._def.button.color === "function" ? d._def.button.color.call(d):(d._def.button.color != null ? d._def.button.color : d._def.color)
//});
-
+
thisNode.selectAll('.node_badge_group').attr("transform",function(d){return "translate("+(d.w-40)+","+(d.h+3)+")";});
thisNode.selectAll('text.node_badge_label').text(function(d,i) {
if (d._def.badge) {
@@ -1581,7 +1581,7 @@ RED.view = (function() {
}
);
var linkEnter = link.enter().insert("g",".node").attr("class","link");
-
+
linkEnter.each(function(d,i) {
var l = d3.select(this);
d.added = true;
@@ -1608,7 +1608,7 @@ RED.view = (function() {
l.append("svg:path").attr("class","link_line link_path")
.classed("link_subflow", function(d) { return activeSubflow && (d.source.type === "subflow" || d.target.type === "subflow") });
});
-
+
link.exit().remove();
var links = vis.selectAll(".link_path");
links.each(function(d) {
@@ -1618,7 +1618,7 @@ RED.view = (function() {
var numOutputs = d.source.outputs || 1;
var sourcePort = d.sourcePort || 0;
var y = -((numOutputs-1)/2)*13 +13*sourcePort;
-
+
var dy = d.target.y-(d.source.y+y);
var dx = (d.target.x-d.target.w/2)-(d.source.x+d.source.w/2);
var delta = Math.sqrt(dy*dy+dx*dx);
@@ -1627,19 +1627,19 @@ RED.view = (function() {
if (delta < node_width) {
scale = 0.75-0.75*((node_width-delta)/node_width);
}
-
+
if (dx < 0) {
scale += 2*(Math.min(5*node_width,Math.abs(dx))/(5*node_width));
if (Math.abs(dy) < 3*node_height) {
scaleY = ((dy>0)?0.5:-0.5)*(((3*node_height)-Math.abs(dy))/(3*node_height))*(Math.min(node_width,Math.abs(dx))/(node_width)) ;
}
}
-
+
d.x1 = d.source.x+d.source.w/2;
d.y1 = d.source.y+y;
d.x2 = d.target.x-d.target.w/2;
d.y2 = d.target.y;
-
+
return "M "+(d.source.x+d.source.w/2)+" "+(d.source.y+y)+
" C "+(d.source.x+d.source.w/2+scale*node_width)+" "+(d.source.y+y+scaleY*node_height)+" "+
(d.target.x-d.target.w/2-scale*node_width)+" "+(d.target.y-scaleY*node_height)+" "+
@@ -1647,9 +1647,9 @@ RED.view = (function() {
});
}
})
-
+
link.classed("link_selected", function(d) { return d === selected_link || d.selected; });
- link.classed("link_unknown",function(d) {
+ link.classed("link_unknown",function(d) {
delete d.added;
return d.target.type == "unknown" || d.source.type == "unknown"
});
@@ -1662,12 +1662,12 @@ RED.view = (function() {
}
).classed("link_selected", false);
}
-
+
if (d3.event) {
d3.event.preventDefault();
}
-
+
}
function focusView() {
@@ -1688,7 +1688,7 @@ RED.view = (function() {
var new_links = result[1];
var new_workspaces = result[2];
var new_subflows = result[3];
-
+
var new_ms = new_nodes.filter(function(n) { return n.z == RED.workspaces.active() }).map(function(n) { return {n:n};});
var new_node_ids = new_nodes.map(function(n){ return n.id; });
@@ -1754,9 +1754,9 @@ RED.view = (function() {
} catch(error) {
if (error.code != "NODE_RED") {
console.log(error.stack);
- RED.notify("Error: "+error,"error");
+ RED.notify(RED._("notification.error")+error,"error");
} else {
- RED.notify("Error: "+error.message,"error");
+ RED.notify(RED._("notification.error")+error.message,"error");
}
}
}
@@ -1764,7 +1764,7 @@ RED.view = (function() {
// TODO: DRY
var eventHandler = (function() {
var handlers = {};
-
+
return {
on: function(evt,func) {
handlers[evt] = handlers[evt]||[];
@@ -1775,12 +1775,12 @@ RED.view = (function() {
for (var i=0;i'+
''+
''+
@@ -37,7 +37,7 @@ RED.user = (function() {
resizable: false,
draggable: false
});
-
+
$("#node-dialog-login-fields").empty();
$.ajax({
dataType: "json",
@@ -45,7 +45,7 @@ RED.user = (function() {
success: function(data) {
if (data.type == "credentials") {
var i=0;
-
+
if (data.image) {
$("#node-dialog-login-image").attr("src",data.image);
} else {
@@ -56,7 +56,7 @@ RED.user = (function() {
var row = $("
",{id:"rrr"+i,class:"form-row"});
$('
').appendTo(row);
var input = $('
').appendTo(row);
-
+
if (i
Login failed'+
- (opts.cancelable?'Cancel':'')+
- ' ').appendTo("#node-dialog-login-fields");
-
-
+ $('').appendTo("#node-dialog-login-fields");
+
+
$("#node-dialog-login-submit").button();
$("#node-dialog-login-fields").submit(function(event) {
$("#node-dialog-login-submit").button("option","disabled",true);
$("#node-dialog-login-failed").hide();
$(".login-spinner").show();
-
+
var body = {
client_id: "node-red-editor",
grant_type: "password",
@@ -116,7 +116,7 @@ RED.user = (function() {
}
}
dialog.dialog("open");
- }
+ }
});
}
@@ -131,17 +131,17 @@ RED.user = (function() {
}
})
}
-
+
function updateUserMenu() {
$("#usermenu-submenu li").remove();
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._("user.loggedInAs",{name:RED.settings.user.username}),"success");
updateUserMenu();
});
});
@@ -154,31 +154,31 @@ RED.user = (function() {
});
RED.menu.addItem("btn-usermenu",{
id:"usermenu-item-logout",
- label:"Logout",
+ label:RED._("menu.label.logout"),
onselect: function() {
RED.user.logout();
}
});
}
-
+
}
-
-
-
+
+
+
function init() {
if (RED.settings.user) {
if (!RED.settings.editorTheme || !RED.settings.editorTheme.hasOwnProperty("userMenu")) {
-
+
$('')
.prependTo(".header-toolbar");
-
+
RED.menu.init({id:"btn-usermenu",
options: []
});
updateUserMenu();
}
}
-
+
}
return {
init: init,
diff --git a/editor/templates/index.mst b/editor/templates/index.mst
index 261df2ad3..b386282aa 100644
--- a/editor/templates/index.mst
+++ b/editor/templates/index.mst
@@ -46,7 +46,7 @@
@@ -55,10 +55,10 @@
@@ -80,14 +80,14 @@
-
+