diff --git a/.gitignore b/.gitignore index 77abb30b2..5415d9f4f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ flows*.json nodes/node-red-nodes/ node_modules public +locales/zz-ZZ +nodes/core/locales/zz-ZZ diff --git a/Gruntfile.js b/Gruntfile.js index 522056a4b..04273c683 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -93,6 +93,7 @@ module.exports = function(grunt) { // Ensure editor source files are concatenated in // the right order "editor/js/main.js", + "editor/js/i18n.js", "editor/js/settings.js", "editor/js/user.js", "editor/js/comms.js", @@ -128,7 +129,8 @@ module.exports = function(grunt) { "editor/vendor/jquery/js/jquery.ui.touch-punch.min.js", "editor/vendor/marked/marked.min.js", "editor/vendor/orion/built-editor.min.js", - "editor/vendor/d3/d3.v3.min.js" + "editor/vendor/d3/d3.v3.min.js", + "editor/vendor/i18next/i18next.min.js" ], "public/vendor/vendor.css": [ "editor/vendor/orion/built-editor.css" @@ -156,6 +158,15 @@ module.exports = function(grunt) { }] } }, + jsonlint: { + messages: { + src: [ + 'nodes/core/locales/en-US/messages.json', + 'locales/en-US/editor.json', + 'locales/en-US/runtime.json' + ] + } + }, attachCopyright: { js: { src: [ @@ -196,6 +207,14 @@ module.exports = function(grunt) { 'editor/sass/**/*.scss' ], tasks: ['sass','attachCopyright:css'] + }, + json: { + files: [ + 'nodes/core/locales/en-US/messages.json', + 'locales/en-US/editor.json', + 'locales/en-US/runtime.json' + ], + tasks: ['jsonlint:messages'] } }, @@ -205,7 +224,7 @@ module.exports = function(grunt) { script: 'red.js', options: { args:['-v'], - ext: 'js,html', + ext: 'js,html,json', watch: [ 'red','nodes' ] @@ -312,6 +331,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-compress'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-chmod'); + grunt.loadNpmTasks('grunt-jsonlint'); grunt.registerMultiTask('attachCopyright', function() { var files = this.data.src; @@ -377,7 +397,7 @@ module.exports = function(grunt) { grunt.registerTask('build', 'Builds editor content', - ['clean:build','concat:build','concat:vendor','uglify:build','sass:build','copy:build','attachCopyright']); + ['clean:build','concat:build','concat:vendor','uglify:build','sass:build','jsonlint:messages','copy:build','attachCopyright']); grunt.registerTask('dev', 'Developer mode: run node-red, watch for source changes and build/restart', diff --git a/editor/js/comms.js b/editor/js/comms.js index 8af17ced6..eb55b6b06 100644 --- a/editor/js/comms.js +++ b/editor/js/comms.js @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ - + RED.comms = (function() { - + var errornotification = null; var clearErrorTimer = null; - + var subscriptions = {}; var ws; var pendingAuth = false; - + function connectWS() { var path = location.hostname; var port = location.port; @@ -32,10 +32,10 @@ RED.comms = (function() { path = path+document.location.pathname; path = path+(path.slice(-1) == "/"?"":"/")+"comms"; path = "ws"+(document.location.protocol=="https:"?"s":"")+"://"+path; - + var auth_tokens = RED.settings.get("auth-tokens"); pendingAuth = (auth_tokens!=null); - + function completeConnection() { for (var t in subscriptions) { if (subscriptions.hasOwnProperty(t)) { @@ -43,7 +43,7 @@ RED.comms = (function() { } } } - + ws = new WebSocket(path); ws.onopen = function() { if (errornotification) { @@ -81,7 +81,7 @@ RED.comms = (function() { }; ws.onclose = function() { if (errornotification == null) { - errornotification = RED.notify("Error: Lost connection to server","error",true); + errornotification = RED.notify(RED._("notification.error",{message:RED._("notification.errors.lostConnection")}),"error",true); } else if (clearErrorTimer) { clearTimeout(clearErrorTimer); clearErrorTimer = null; @@ -89,7 +89,7 @@ RED.comms = (function() { setTimeout(connectWS,1000); } } - + function subscribe(topic,callback) { if (subscriptions[topic] == null) { subscriptions[topic] = []; @@ -99,7 +99,7 @@ RED.comms = (function() { ws.send(JSON.stringify({subscribe:topic})); } } - + function unsubscribe(topic,callback) { if (subscriptions[topic]) { for (var i=0;i
  • ")+"
  • "; - RED.notify("Node"+(addedTypes.length!=1 ? "s":"")+" added to palette:"+typeList,"success"); + RED.notify(RED._("palette.event.nodeAdded", {count:addedTypes.length})+typeList,"success"); } } else if (topic == "node/removed") { for (i=0;i
  • ")+"
  • "; - RED.notify("Node"+(m.types.length!=1 ? "s":"")+" removed from palette:"+typeList,"success"); + RED.notify(RED._("palette.event.nodeRemoved", {count:m.types.length})+typeList,"success"); } } } else if (topic == "node/enabled") { @@ -108,12 +130,12 @@ var RED = (function() { if (info.added) { RED.nodes.enableNodeSet(msg.id); typeList = ""; - RED.notify("Node"+(msg.types.length!=1 ? "s":"")+" enabled:"+typeList,"success"); + RED.notify(RED._("palette.event.nodeEnabled", {count:msg.types.length})+typeList,"success"); } else { $.get('nodes/'+msg.id, function(data) { $("body").append(data); typeList = ""; - RED.notify("Node"+(msg.types.length!=1 ? "s":"")+" added to palette:"+typeList,"success"); + RED.notify(RED._("palette.event.nodeAdded", {count:msg.types.length})+typeList,"success"); }); } } @@ -121,7 +143,7 @@ var RED = (function() { if (msg.types) { RED.nodes.disableNodeSet(msg.id); typeList = ""; - RED.notify("Node"+(msg.types.length!=1 ? "s":"")+" disabled:"+typeList,"success"); + RED.notify(RED._("palette.event.nodeDisabled", {count:msg.types.length})+typeList,"success"); } } }); @@ -138,42 +160,42 @@ var RED = (function() { function loadEditor() { RED.menu.init({id:"btn-sidemenu", options: [ - {id:"menu-item-sidebar",label:"Sidebar",toggle:true,onselect:RED.sidebar.toggleSidebar, selected: true}, - {id:"menu-item-status",label:"Display node status",toggle:true,onselect:toggleStatus, selected: true}, + {id:"menu-item-sidebar",label:RED._("menu.label.sidebar"),toggle:true,onselect:RED.sidebar.toggleSidebar, selected: true}, + {id:"menu-item-status",label:RED._("menu.label.displayStatus"),toggle:true,onselect:toggleStatus, selected: true}, null, - {id:"menu-item-import",label:"Import",options:[ - {id:"menu-item-import-clipboard",label:"Clipboard",onselect:RED.clipboard.import}, - {id:"menu-item-import-library",label:"Library",options:[]} + {id:"menu-item-import",label:RED._("menu.label.import"),options:[ + {id:"menu-item-import-clipboard",label:RED._("menu.label.clipboard"),onselect:RED.clipboard.import}, + {id:"menu-item-import-library",label:RED._("menu.label.library"),options:[]} ]}, - {id:"menu-item-export",label:"Export",disabled:true,options:[ - {id:"menu-item-export-clipboard",label:"Clipboard",disabled:true,onselect:RED.clipboard.export}, - {id:"menu-item-export-library",label:"Library",disabled:true,onselect:RED.library.export} + {id:"menu-item-export",label:RED._("menu.label.export"),disabled:true,options:[ + {id:"menu-item-export-clipboard",label:RED._("menu.label.clipboard"),disabled:true,onselect:RED.clipboard.export}, + {id:"menu-item-export-library",label:RED._("menu.label.library"),disabled:true,onselect:RED.library.export} ]}, null, - {id:"menu-item-config-nodes",label:"Configuration nodes",onselect:RED.sidebar.config.show}, + {id:"menu-item-config-nodes",label:RED._("menu.label.configurationNodes"),onselect:RED.sidebar.config.show}, null, - {id:"menu-item-subflow",label:"Subflows", options: [ - {id:"menu-item-subflow-create",label:"Create subflow",onselect:RED.subflow.createSubflow}, - {id:"menu-item-subflow-convert",label:"Selection to subflow",disabled:true,onselect:RED.subflow.convertToSubflow}, + {id:"menu-item-subflow",label:RED._("menu.label.subflows"), options: [ + {id:"menu-item-subflow-create",label:RED._("menu.label.createSubflow"),onselect:RED.subflow.createSubflow}, + {id:"menu-item-subflow-convert",label:RED._("menu.label.selectionToSubflow"),disabled:true,onselect:RED.subflow.convertToSubflow}, ]}, null, - {id:"menu-item-workspace",label:"Workspaces",options:[ - {id:"menu-item-workspace-add",label:"Add",onselect:RED.workspaces.add}, - {id:"menu-item-workspace-edit",label:"Rename",onselect:RED.workspaces.edit}, - {id:"menu-item-workspace-delete",label:"Delete",onselect:RED.workspaces.remove}, + {id:"menu-item-workspace",label:RED._("menu.label.workspaces"),options:[ + {id:"menu-item-workspace-add",label:RED._("menu.label.add"),onselect:RED.workspaces.add}, + {id:"menu-item-workspace-edit",label:RED._("menu.label.rename"),onselect:RED.workspaces.edit}, + {id:"menu-item-workspace-delete",label:RED._("menu.label.delete"),onselect:RED.workspaces.remove}, null ]}, null, - {id:"menu-item-keyboard-shortcuts",label:"Keyboard Shortcuts",onselect:RED.keyboard.showHelp}, + {id:"menu-item-keyboard-shortcuts",label:RED._("menu.label.keyboardShortcuts"),onselect:RED.keyboard.showHelp}, {id:"menu-item-help", label: RED.settings.theme("menu.menu-item-help.label","Node-RED Website"), href: RED.settings.theme("menu.menu-item-help.url","http://nodered.org/docs") } ] }); - + RED.user.init(); - + RED.library.init(); RED.palette.init(); RED.sidebar.init(); @@ -181,9 +203,10 @@ var RED = (function() { RED.workspaces.init(); RED.clipboard.init(); RED.view.init(); - + RED.editor.init(); + RED.deploy.init(RED.settings.theme("deployButton",null)); - + RED.keyboard.add(/* ? */ 191,{shift:true},function(){RED.keyboard.showHelp();d3.event.preventDefault();}); RED.comms.connect(); @@ -194,14 +217,14 @@ var RED = (function() { } $(function() { - + if ((window.location.hostname !== "localhost") && (window.location.hostname !== "127.0.0.1")) { document.title = document.title+" : "+window.location.hostname; } - + ace.require("ace/ext/language_tools"); - RED.settings.init(loadEditor); + RED.settings.init(loadLocales); }); diff --git a/editor/js/nodes.js b/editor/js/nodes.js index 16e243286..240aecfff 100644 --- a/editor/js/nodes.js +++ b/editor/js/nodes.js @@ -22,20 +22,20 @@ RED.nodes = (function() { var defaultWorkspace; var workspaces = {}; var subflows = {}; - + var dirty = false; - + function setDirty(d) { dirty = d; eventHandler.emit("change",{dirty:dirty}); } - + var registry = (function() { var nodeList = []; var nodeSets = {}; var typeToId = {}; var nodeDefinitions = {}; - + var exports = { getNodeList: function() { return nodeList; @@ -107,7 +107,23 @@ RED.nodes = (function() { registerNodeType: function(nt,def) { nodeDefinitions[nt] = def; if (def.category != "subflows") { + def.set = nodeSets[typeToId[nt]]; nodeSets[typeToId[nt]].added = true; + + var ns; + if (def.set.module === "node-red") { + ns = "node-red"; + } else { + ns = def.set.id; + } + def["_"] = function() { + var args = Array.prototype.slice.call(arguments, 0); + if (args[0].indexOf(":") === -1) { + args[0] = ns+":"+args[0]; + } + return RED._.apply(null,args); + } + // TODO: too tightly coupled into palette UI } RED.palette.add(nt,def); @@ -117,6 +133,7 @@ RED.nodes = (function() { }, removeNodeType: function(nt) { if (nt.substring(0,8) != "subflow:") { + // NON-NLS - internal debug message throw new Error("this api is subflow only. called with:",nt); } delete nodeDefinitions[nt]; @@ -128,12 +145,15 @@ RED.nodes = (function() { }; return exports; })(); - + function getID() { return (1+Math.random()*4294967295).toString(16); } function addNode(n) { + if (n.type.indexOf("subflow") !== 0) { + n["_"] = n._def._; + } if (n._def.category == "config") { configNodes[n.id] = n; RED.sidebar.config.refresh(); @@ -265,7 +285,7 @@ RED.nodes = (function() { var subflowNames = Object.keys(subflows).map(function(sfid) { return subflows[sfid].name; }); - + subflowNames.sort(); var copyNumber = 1; var subflowName = sf.name; @@ -277,7 +297,7 @@ RED.nodes = (function() { }); sf.name = subflowName; } - + subflows[sf.id] = sf; RED.nodes.registerType("subflow:"+sf.id, { defaults:{name:{value:""}}, @@ -288,10 +308,13 @@ RED.nodes = (function() { color: "#da9", label: function() { return this.name||RED.nodes.subflow(sf.id).name }, labelStyle: function() { return this.name?"node_label_italic":""; }, - paletteLabel: function() { return RED.nodes.subflow(sf.id).name } + paletteLabel: function() { return RED.nodes.subflow(sf.id).name }, + set:{ + module: "node-red" + } }); - - + + } function getSubflow(id) { return subflows[id]; @@ -300,7 +323,7 @@ RED.nodes = (function() { delete subflows[sf.id]; registry.removeNodeType("subflow:"+sf.id); } - + function subflowContains(sfid,nodeid) { for (var i=0;i 0) { var typeList = "
    • "+unknownTypes.join("
    • ")+"
    "; var type = "type"+(unknownTypes.length > 1?"s":""); - RED.notify("Imported unrecognised "+type+":"+typeList,"error",false,10000); - //"DO NOT DEPLOY while in this state.
    Either, add missing types to Node-RED, restart and then reload page,
    or delete unknown "+n.name+", rewire as required, and then deploy.","error"); + RED.notify(""+RED._("clipboard.importUnrecognised",{count:unknownTypes.length})+""+typeList,"error",false,10000); } var activeWorkspace = RED.workspaces.active(); @@ -568,21 +589,20 @@ 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._("notification.errors.cannotAddSubflowToItself")); } if (subflowContains(m[1],activeSubflow.id)) { - err = new Error("Cannot add subflow - circular reference detected"); + err = new Error(RED._("notification.errors.cannotAddCircularReference")); } if (err) { // TODO: standardise error codes err.code = "NODE_RED"; throw err; } - } } } - + var new_workspaces = []; var workspace_map = {}; var new_subflows = []; @@ -704,11 +724,13 @@ RED.nodes = (function() { defaults: {}, label: "unknown: "+n.type, labelStyle: "node_label_italic", - outputs: n.outputs||n.wires.length + outputs: n.outputs||n.wires.length, + set: registry.getNodeSet("node-red/unknown") } } else { node._def = { - category:"config" + category:"config", + set: registry.getNodeSet("node-red/unknown") }; node.users = []; } @@ -779,14 +801,14 @@ RED.nodes = (function() { delete output.wires; }); } - + return [new_nodes,new_links,new_workspaces,new_subflows]; } - + // TODO: supports filter.z|type function filterNodes(filter) { var result = []; - + for (var n=0;n
    ') - .appendTo("body") - .dialog({ - modal: true, - autoOpen: false, - width: 500, - resizable: false, - buttons: [ - { - id: "clipboard-dialog-ok", - text: "Ok", - click: function() { - if (/Import/.test(dialog.dialog("option","title"))) { - RED.view.importNodes($("#clipboard-import").val()); - } - $( this ).dialog( "close" ); - } - }, - { - id: "clipboard-dialog-cancel", - text: "Cancel", - click: function() { - $( this ).dialog( "close" ); - } - }, - { - id: "clipboard-dialog-close", - text: "Close", - click: function() { - $( this ).dialog( "close" ); - } - } - ], - open: function(e) { - $(this).parent().find(".ui-dialog-titlebar-close").hide(); - RED.keyboard.disable(); - }, - close: function(e) { - RED.keyboard.enable(); - } - }); - var dialogContainer = dialog.children(".dialog-form"); - - var exportNodesDialog = '
    '+ - ''+ - ''+ - '
    '+ - '
    '+ - 'Select the text above and copy to the clipboard with Ctrl-C.'+ - '
    '; - - var importNodesDialog = '
    '+ - ''+ - '
    '; + var dialog; + var dialogContainer; + var exportNodesDialog; + var importNodesDialog; + + function setupDialogs(){ + dialog = $('
    ') + .appendTo("body") + .dialog({ + modal: true, + autoOpen: false, + width: 500, + resizable: false, + buttons: [ + { + id: "clipboard-dialog-ok", + text: RED._("common.label.ok"), + click: function() { + if (/Import/.test(dialog.dialog("option","title"))) { + RED.view.importNodes($("#clipboard-import").val()); + } + $( this ).dialog( "close" ); + } + }, + { + id: "clipboard-dialog-cancel", + text: RED._("common.label.cancel"), + click: function() { + $( this ).dialog( "close" ); + } + }, + { + id: "clipboard-dialog-close", + text: RED._("common.label.close"), + click: function() { + $( this ).dialog( "close" ); + } + } + ], + open: function(e) { + $(this).parent().find(".ui-dialog-titlebar-close").hide(); + RED.keyboard.disable(); + }, + close: function(e) { + RED.keyboard.enable(); + } + }); + + dialogContainer = dialog.children(".dialog-form"); + + exportNodesDialog = '
    '+ + ''+ + ''+ + '
    '+ + '
    '+ + RED._("clipboard.selectNodes")+ + '
    '; + + importNodesDialog = '
    '+ + ''+ + '
    '; + } function validateImport() { var importInput = $("#clipboard-import"); @@ -87,7 +96,7 @@ RED.clipboard = (function() { $("#clipboard-dialog-ok").button("disable"); } } - + function importNodes() { dialogContainer.empty(); dialogContainer.append($(importNodesDialog)); @@ -97,8 +106,8 @@ RED.clipboard = (function() { $("#clipboard-dialog-ok").button("disable"); $("#clipboard-import").keyup(validateImport); $("#clipboard-import").on('paste',function() { setTimeout(validateImport,10)}); - - dialog.dialog("option","title","Import nodes").dialog("open"); + + dialog.dialog("option","title",RED._("clipboard.importNodes")).dialog("open"); } function exportNodes() { @@ -120,17 +129,18 @@ RED.clipboard = (function() { return false; }) }); - dialog.dialog("option","title","Export nodes to clipboard").dialog( "open" ); + dialog.dialog("option","title",RED._("clipboard.exportNodes")).dialog( "open" ); } } - + function hideDropTarget() { $("#dropTarget").hide(); RED.keyboard.remove(/* ESCAPE */ 27); } - + return { init: function() { + setupDialogs(); RED.view.on("selection-changed",function(selection) { if (!selection.nodes) { RED.menu.setDisabled("menu-item-export",true); @@ -144,16 +154,16 @@ RED.clipboard = (function() { }); RED.keyboard.add(/* e */ 69,{ctrl:true},function(){exportNodes();d3.event.preventDefault();}); RED.keyboard.add(/* i */ 73,{ctrl:true},function(){importNodes();d3.event.preventDefault();}); - - - + + + $('#chart').on("dragenter",function(event) { if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) { $("#dropTarget").css({display:'table'}); RED.keyboard.add(/* ESCAPE */ 27,hideDropTarget); } }); - + $('#dropTarget').on("dragover",function(event) { if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) { event.preventDefault(); @@ -168,15 +178,15 @@ RED.clipboard = (function() { RED.view.importNodes(data); event.preventDefault(); }); - - + + }, import: importNodes, export: exportNodes } - - - - - + + + + + })(); diff --git a/editor/js/ui/deploy.js b/editor/js/ui/deploy.js index 90f75d1a5..09b71b22f 100644 --- a/editor/js/ui/deploy.js +++ b/editor/js/ui/deploy.js @@ -13,29 +13,29 @@ * See the License for the specific language governing permissions and * limitations under the License. **/ - + RED.deploy = (function() { - + var deploymentTypes = { "full":{img:"red/images/deploy-full-o.png"}, "nodes":{img:"red/images/deploy-nodes-o.png"}, "flows":{img:"red/images/deploy-flows-o.png"} } - + var ignoreDeployWarnings = { unknown: false, unusedConfig: false, invalid: false } - + var deploymentType = "full"; - + function changeDeploymentType(type) { deploymentType = type; $("#btn-deploy img").attr("src",deploymentTypes[type].img); } - - + + /** * options: * type: "default" - Button with drop-down options - no further customisation available @@ -46,35 +46,35 @@ RED.deploy = (function() { function init(options) { options = options || {}; var type = options.type || "default"; - + if (type == "default") { $('
  • '+ - ' Deploy'+ + ' '+RED._("deploy.deploy")+''+ ''+ '
  • ').prependTo(".header-toolbar"); RED.menu.init({id:"btn-deploy-options", options: [ - {id:"deploymenu-item-full",toggle:"deploy-type",icon:"red/images/deploy-full.png",label:"Full",sublabel:"Deploys everything in the workspace",selected: true, onselect:function(s) { if(s){changeDeploymentType("full")}}}, - {id:"deploymenu-item-flow",toggle:"deploy-type",icon:"red/images/deploy-flows.png",label:"Modified Flows",sublabel:"Only deploys flows that contain changed nodes", onselect:function(s) {if(s){changeDeploymentType("flows")}}}, - {id:"deploymenu-item-node",toggle:"deploy-type",icon:"red/images/deploy-nodes.png",label:"Modified Nodes",sublabel:"Only deploys nodes that have changed",onselect:function(s) { if(s){changeDeploymentType("nodes")}}} + {id:"deploymenu-item-full",toggle:"deploy-type",icon:"red/images/deploy-full.png",label:RED._("deploy.full"),sublabel:RED._("deploy.fullDesc"),selected: true, onselect:function(s) { if(s){changeDeploymentType("full")}}}, + {id:"deploymenu-item-flow",toggle:"deploy-type",icon:"red/images/deploy-flows.png",label:RED._("deploy.modifiedFlows"),sublabel:RED._("deploy.modifiedFlowsDesc"), onselect:function(s) {if(s){changeDeploymentType("flows")}}}, + {id:"deploymenu-item-node",toggle:"deploy-type",icon:"red/images/deploy-nodes.png",label:RED._("deploy.modifiedNodes"),sublabel:RED._("deploy.modifiedNodesDesc"),onselect:function(s) { if(s){changeDeploymentType("nodes")}}} ] }); } else if (type == "simple") { - var label = options.label || "Deploy"; + var label = options.label || RED._("deploy.deploy"); var icon = 'red/images/deploy-full-o.png'; if (options.hasOwnProperty('icon')) { icon = options.icon; } - + $('
  • '+ ''+ (icon?' ':'')+ ''+label+''+ '
  • ').prependTo(".header-toolbar"); } - + $('#btn-deploy').click(function() { save(); }); - + $( "#node-dialog-confirm-deploy" ).dialog({ title: "Confirm deploy", modal: true, @@ -83,9 +83,9 @@ RED.deploy = (function() { height: "auto", buttons: [ { - text: "Confirm deploy", + text: RED._("deploy.confirm.button.confirm"), click: function() { - + var ignoreChecked = $( "#node-dialog-confirm-deploy-hide" ).prop("checked"); if (ignoreChecked) { ignoreDeployWarnings[$( "#node-dialog-confirm-deploy-type" ).val()] = true; @@ -95,7 +95,7 @@ RED.deploy = (function() { } }, { - text: "Cancel", + text: RED._("deploy.confirm.button.cancel"), click: function() { $( this ).dialog( "close" ); } @@ -114,7 +114,7 @@ RED.deploy = (function() { RED.nodes.on('change',function(state) { if (state.dirty) { window.onbeforeunload = function() { - return "You have undeployed changes.\n\nLeaving this page will lose these changes."; + return RED._("deploy.confirm.undeployedChanges"); } $("#btn-deploy").removeClass("disabled"); } else { @@ -132,7 +132,7 @@ RED.deploy = (function() { var hasUnknown = false; var hasInvalid = false; var hasUnusedConfig = false; - + var unknownNodes = []; RED.nodes.eachNode(function(node) { hasInvalid = hasInvalid || !node.valid; @@ -143,7 +143,7 @@ RED.deploy = (function() { } }); hasUnknown = unknownNodes.length > 0; - + var unusedConfigNodes = {}; RED.nodes.eachConfig(function(node) { if (node.users.length === 0) { @@ -159,13 +159,13 @@ RED.deploy = (function() { hasUnusedConfig = true; } }); - + $( "#node-dialog-confirm-deploy-config" ).hide(); $( "#node-dialog-confirm-deploy-unknown" ).hide(); $( "#node-dialog-confirm-deploy-unused" ).hide(); - + var showWarning = false; - + if (hasUnknown && !ignoreDeployWarnings.unknown) { showWarning = true; $( "#node-dialog-confirm-deploy-type" ).val("unknown"); @@ -186,7 +186,7 @@ RED.deploy = (function() { unusedConfigNodes[type].forEach(function(label) { unusedNodeLabels.push(type+": "+label); }); - }); + }); $( "#node-dialog-confirm-deploy-unused-list" ) .html("
  • "+unusedNodeLabels.join("
  • ")+"
  • "); } @@ -196,10 +196,10 @@ RED.deploy = (function() { return; } } - - - - + + + + var nns = RED.nodes.createCompleteNodeSet(); $("#btn-deploy-icon").removeClass('fa-download'); @@ -215,7 +215,7 @@ RED.deploy = (function() { "Node-RED-Deployment-Type":deploymentType } }).done(function(data,textStatus,xhr) { - RED.notify("Successfully deployed","success"); + RED.notify(RED._("deploy.successfulDeploy"),"success"); RED.nodes.eachNode(function(node) { if (node.changed) { node.dirty = true; @@ -236,9 +236,9 @@ RED.deploy = (function() { }).fail(function(xhr,textStatus,err) { RED.nodes.dirty(true); if (xhr.responseText) { - RED.notify("Error: "+xhr.responseJSON.message,"error"); + RED.notify(RED._("notification.error",{message:xhr.responseJSON.message}),"error"); } else { - RED.notify("Error: no response from server","error"); + RED.notify(RED._("notification.error",{message:RED._("deploy.errors.noResponse")}),"error"); } }).always(function() { $("#btn-deploy-icon").removeClass('spinner'); diff --git a/editor/js/ui/editor.js b/editor/js/ui/editor.js index 1a41fcd33..6e9e03756 100644 --- a/editor/js/ui/editor.js +++ b/editor/js/ui/editor.js @@ -168,184 +168,186 @@ RED.editor = (function() { return removedLinks; } - $( "#dialog" ).dialog({ - modal: true, - autoOpen: false, - dialogClass: "ui-dialog-no-close", - closeOnEscape: false, - minWidth: 500, - width: 'auto', - buttons: [ - { - id: "node-dialog-ok", - text: "Ok", - click: function() { - if (editing_node) { - var changes = {}; - var changed = false; - var wasDirty = RED.nodes.dirty(); - var d; + function createDialog(){ + $( "#dialog" ).dialog({ + modal: true, + autoOpen: false, + dialogClass: "ui-dialog-no-close", + closeOnEscape: false, + minWidth: 500, + width: 'auto', + buttons: [ + { + id: "node-dialog-ok", + text: RED._("common.label.ok"), + click: function() { + if (editing_node) { + var changes = {}; + var changed = false; + var wasDirty = RED.nodes.dirty(); + var d; - if (editing_node._def.oneditsave) { - var oldValues = {}; - for (d in editing_node._def.defaults) { - if (editing_node._def.defaults.hasOwnProperty(d)) { - if (typeof editing_node[d] === "string" || typeof editing_node[d] === "number") { - oldValues[d] = editing_node[d]; - } else { - oldValues[d] = $.extend(true,{},{v:editing_node[d]}).v; + if (editing_node._def.oneditsave) { + var oldValues = {}; + for (d in editing_node._def.defaults) { + if (editing_node._def.defaults.hasOwnProperty(d)) { + if (typeof editing_node[d] === "string" || typeof editing_node[d] === "number") { + oldValues[d] = editing_node[d]; + } else { + oldValues[d] = $.extend(true,{},{v:editing_node[d]}).v; + } } } - } - var rc = editing_node._def.oneditsave.call(editing_node); - if (rc === true) { - changed = true; - } + var rc = editing_node._def.oneditsave.call(editing_node); + if (rc === true) { + changed = true; + } - for (d in editing_node._def.defaults) { - if (editing_node._def.defaults.hasOwnProperty(d)) { - if (oldValues[d] === null || typeof oldValues[d] === "string" || typeof oldValues[d] === "number") { - if (oldValues[d] !== editing_node[d]) { - changes[d] = oldValues[d]; - changed = true; - } - } else { - if (JSON.stringify(oldValues[d]) !== JSON.stringify(editing_node[d])) { - changes[d] = oldValues[d]; - changed = true; + for (d in editing_node._def.defaults) { + if (editing_node._def.defaults.hasOwnProperty(d)) { + if (oldValues[d] === null || typeof oldValues[d] === "string" || typeof oldValues[d] === "number") { + if (oldValues[d] !== editing_node[d]) { + changes[d] = oldValues[d]; + changed = true; + } + } else { + if (JSON.stringify(oldValues[d]) !== JSON.stringify(editing_node[d])) { + changes[d] = oldValues[d]; + changed = true; + } } } } } - } - if (editing_node._def.defaults) { - for (d in editing_node._def.defaults) { - if (editing_node._def.defaults.hasOwnProperty(d)) { - var input = $("#node-input-"+d); - var newValue; - if (input.attr('type') === "checkbox") { - newValue = input.prop('checked'); - } else { - newValue = input.val(); - } - if (newValue != null) { - if (editing_node[d] != newValue) { + if (editing_node._def.defaults) { + for (d in editing_node._def.defaults) { + if (editing_node._def.defaults.hasOwnProperty(d)) { + var input = $("#node-input-"+d); + var newValue; + if (input.attr('type') === "checkbox") { + newValue = input.prop('checked'); + } else { + newValue = input.val(); + } + if (newValue != null) { if (d === "outputs" && (newValue.trim() === "" || isNaN(newValue))) { continue; } - if (editing_node._def.defaults[d].type) { - if (newValue == "_ADD_") { - newValue = ""; - } - // Change to a related config node - var configNode = RED.nodes.node(editing_node[d]); - if (configNode) { - var users = configNode.users; - users.splice(users.indexOf(editing_node),1); - } - configNode = RED.nodes.node(newValue); - if (configNode) { - configNode.users.push(editing_node); + if (editing_node[d] != newValue) { + if (editing_node._def.defaults[d].type) { + if (newValue == "_ADD_") { + newValue = ""; + } + // Change to a related config node + var configNode = RED.nodes.node(editing_node[d]); + if (configNode) { + var users = configNode.users; + users.splice(users.indexOf(editing_node),1); + } + configNode = RED.nodes.node(newValue); + if (configNode) { + configNode.users.push(editing_node); + } } + changes[d] = editing_node[d]; + editing_node[d] = newValue; + changed = true; } - changes[d] = editing_node[d]; - editing_node[d] = newValue; - changed = true; } } } } - } - if (editing_node._def.credentials) { - var prefix = 'node-input'; - var credDefinition = editing_node._def.credentials; - var credsChanged = updateNodeCredentials(editing_node,credDefinition,prefix); - changed = changed || credsChanged; - } + if (editing_node._def.credentials) { + var prefix = 'node-input'; + var credDefinition = editing_node._def.credentials; + var credsChanged = updateNodeCredentials(editing_node,credDefinition,prefix); + changed = changed || credsChanged; + } - var removedLinks = updateNodeProperties(editing_node); - if (changed) { - var wasChanged = editing_node.changed; - editing_node.changed = true; - RED.nodes.dirty(true); - RED.history.push({t:'edit',node:editing_node,changes:changes,links:removedLinks,dirty:wasDirty,changed:wasChanged}); - } - editing_node.dirty = true; - validateNode(editing_node); - RED.view.redraw(); - } else if (/Export nodes to library/.test($( "#dialog" ).dialog("option","title"))) { - //TODO: move this to RED.library - var flowName = $("#node-input-filename").val(); - if (!/^\s*$/.test(flowName)) { - $.ajax({ - url:'library/flows/'+flowName, - type: "POST", - data: $("#node-input-filename").attr('nodes'), - contentType: "application/json; charset=utf-8" - }).done(function() { - RED.library.loadFlowLibrary(); - RED.notify("Saved nodes","success"); - }); + var removedLinks = updateNodeProperties(editing_node); + if (changed) { + var wasChanged = editing_node.changed; + editing_node.changed = true; + RED.nodes.dirty(true); + RED.history.push({t:'edit',node:editing_node,changes:changes,links:removedLinks,dirty:wasDirty,changed:wasChanged}); + } + editing_node.dirty = true; + validateNode(editing_node); + RED.view.redraw(); + } else if (/Export nodes to library/.test($( "#dialog" ).dialog("option","title"))) { + //TODO: move this to RED.library + var flowName = $("#node-input-filename").val(); + if (!/^\s*$/.test(flowName)) { + $.ajax({ + url:'library/flows/'+flowName, + type: "POST", + data: $("#node-input-filename").attr('nodes'), + contentType: "application/json; charset=utf-8" + }).done(function() { + RED.library.loadFlowLibrary(); + RED.notify(RED._("library.savedNodes"),"success"); + }); + } } + $( this ).dialog( "close" ); } - $( this ).dialog( "close" ); + }, + { + id: "node-dialog-cancel", + text: RED._("common.label.cancel"), + click: function() { + if (editing_node && editing_node._def) { + if (editing_node._def.oneditcancel) { + editing_node._def.oneditcancel.call(editing_node); + } + } + $( this ).dialog( "close" ); + } + } + ], + resize: function(e,ui) { + if (editing_node) { + $(this).dialog('option',"sizeCache-"+editing_node.type,ui.size); } }, - { - id: "node-dialog-cancel", - text: "Cancel", - click: function() { - if (editing_node && editing_node._def) { - if (editing_node._def.oneditcancel) { - editing_node._def.oneditcancel.call(editing_node); - } + open: function(e) { + var minWidth = $(this).dialog('option','minWidth'); + if ($(this).outerWidth() < minWidth) { + $(this).dialog('option','width',minWidth); + } else { + $(this).dialog('option','width',$(this).outerWidth()); + } + RED.keyboard.disable(); + if (editing_node) { + var size = $(this).dialog('option','sizeCache-'+editing_node.type); + if (size) { + $(this).dialog('option','width',size.width); + $(this).dialog('option','height',size.height); } - $( this ).dialog( "close" ); } - } - ], - resize: function(e,ui) { - if (editing_node) { - $(this).dialog('option',"sizeCache-"+editing_node.type,ui.size); - } - }, - open: function(e) { - var minWidth = $(this).dialog('option','minWidth'); - if ($(this).outerWidth() < minWidth) { - $(this).dialog('option','width',minWidth); - } else { - $(this).dialog('option','width',$(this).outerWidth()); - } - RED.keyboard.disable(); - if (editing_node) { - var size = $(this).dialog('option','sizeCache-'+editing_node.type); - if (size) { - $(this).dialog('option','width',size.width); - $(this).dialog('option','height',size.height); + }, + close: function(e) { + RED.keyboard.enable(); + + if (RED.view.state() != RED.state.IMPORT_DRAGGING) { + RED.view.state(RED.state.DEFAULT); } - } - }, - close: function(e) { - RED.keyboard.enable(); + $( this ).dialog('option','height','auto'); + $( this ).dialog('option','width','auto'); + if (editing_node) { + RED.sidebar.info.refresh(editing_node); + } + RED.sidebar.config.refresh(); - if (RED.view.state() != RED.state.IMPORT_DRAGGING) { - RED.view.state(RED.state.DEFAULT); + var buttons = $( this ).dialog("option","buttons"); + if (buttons.length == 3) { + $( this ).dialog("option","buttons",buttons.splice(1)); + } + editing_node = null; } - $( this ).dialog('option','height','auto'); - $( this ).dialog('option','width','auto'); - if (editing_node) { - RED.sidebar.info.refresh(editing_node); - } - RED.sidebar.config.refresh(); - - var buttons = $( this ).dialog("option","buttons"); - if (buttons.length == 3) { - $( this ).dialog("option","buttons",buttons.splice(1)); - } - editing_node = null; - } - }); + }); + } /** * Create a config-node select box for this property @@ -392,9 +394,9 @@ RED.editor = (function() { input.after(button); if (node[property]) { - button.text("edit"); + button.text(RED._("editor.configEdit")); } else { - button.text("add"); + button.text(RED._("editor.configAdd")); } button.click(function(e) { @@ -565,7 +567,7 @@ RED.editor = (function() { var buttons = $( "#dialog" ).dialog("option","buttons"); buttons.unshift({ class: 'leftButton', - text: "Edit flow", + text: RED._("subflow.edit"), click: function() { RED.workspaces.show(id); $("#node-dialog-ok").click(); @@ -574,21 +576,44 @@ RED.editor = (function() { $( "#dialog" ).dialog("option","buttons",buttons); } $("#dialog-form").html($("script[data-template-name='"+type+"']").html()); + var ns; + if (node._def.set.module === "node-red") { + ns = "node-red"; + } else { + ns = node._def.set.id; + } + $("#dialog-form").find('[data-i18n]').each(function() { + var current = $(this).attr("data-i18n"); + if (current.indexOf(":") === -1) { + var prefix = ""; + if (current.indexOf("[")===0) { + var parts = current.split("]"); + prefix = parts[0]+"]"; + current = parts[1]; + } + + $(this).attr("data-i18n",prefix+ns+":"+current); + } + }); $('').appendTo("#dialog-form"); prepareEditDialog(node,node._def,"node-input"); - - - - - + $("#dialog").i18n(); $( "#dialog" ).dialog("option","title","Edit "+type+" node").dialog( "open" ); } function showEditConfigNodeDialog(name,type,id) { var adding = (id == "_ADD_"); var node_def = RED.nodes.getType(type); - var configNode = RED.nodes.node(id); + + var ns; + if (node_def.set.module === "node-red") { + ns = "node-red"; + } else { + ns = node_def.set.id; + } + + if (configNode == null) { configNode = { id: (1+Math.random()*4294967295).toString(16), @@ -600,9 +625,25 @@ RED.editor = (function() { configNode[d] = node_def.defaults[d].value; } } + configNode["_"] = node_def._; } $("#dialog-config-form").html($("script[data-template-name='"+type+"']").html()); + + $("#dialog-config-form").find('[data-i18n]').each(function() { + var current = $(this).attr("data-i18n"); + if (current.indexOf(":") === -1) { + var prefix = ""; + if (current.indexOf("[")===0) { + var parts = current.split("]"); + prefix = parts[0]+"]"; + current = parts[1]; + } + $(this).attr("data-i18n",prefix+ns+":"+current); + } + }); + + prepareEditDialog(configNode,node_def,"node-config-input"); var buttons = $( "#node-config-dialog" ).dialog("option","buttons"); @@ -616,7 +657,7 @@ RED.editor = (function() { if (buttons.length == 2) { buttons.unshift({ class: 'leftButton', - text: "Delete", + text: RED._("editor.configDelete"), click: function() { var configProperty = $(this).dialog('option','node-property'); var configId = $(this).dialog('option','node-id'); @@ -648,16 +689,18 @@ RED.editor = (function() { }); } buttons[1].text = "Update"; - $("#node-config-dialog-user-count").html(configNode.users.length+" node"+(configNode.users.length==1?" uses":"s use")+" this config").show(); + $("#node-config-dialog-user-count").html(RED._("editor.nodesUse", {count:configNode.users.length})).show(); } $( "#node-config-dialog" ).dialog("option","buttons",buttons); + $("#node-config-dialog").i18n(); + $( "#node-config-dialog" ) .dialog("option","node-adding",adding) .dialog("option","node-property",name) .dialog("option","node-id",configNode.id) .dialog("option","node-type",type) - .dialog("option","title",(adding?"Add new ":"Edit ")+type+" config node") + .dialog("option","title",(adding?RED._("editor.addNewConfig", {type:type}):RED._("editor.editConfig", {type:type}))) .dialog( "open" ); } @@ -665,9 +708,9 @@ RED.editor = (function() { var button = $("#node-input-edit-"+name); if (button.length) { if (value) { - button.text("edit"); + button.text(RED._("editor.configEdit")); } else { - button.text("add"); + button.text(RED._("editor.configAdd")); } $("#node-input-"+name).val(value); } else { @@ -686,208 +729,211 @@ RED.editor = (function() { select.append(''); } }); - - select.append(''); + select.append(''); window.setTimeout(function() { select.change();},50); } } - $( "#node-config-dialog" ).dialog({ + function createNodeConfigDialog(){ + $( "#node-config-dialog" ).dialog({ + modal: true, + autoOpen: false, + dialogClass: "ui-dialog-no-close", + minWidth: 500, + width: 'auto', + closeOnEscape: false, + buttons: [ + { + id: "node-config-dialog-ok", + text: RED._("common.label.ok"), + click: function() { + var configProperty = $(this).dialog('option','node-property'); + var configId = $(this).dialog('option','node-id'); + var configType = $(this).dialog('option','node-type'); + var configAdding = $(this).dialog('option','node-adding'); + var configTypeDef = RED.nodes.getType(configType); + var configNode; + var d; + var input; + + if (configAdding) { + configNode = {type:configType,id:configId,users:[]}; + for (d in configTypeDef.defaults) { + if (configTypeDef.defaults.hasOwnProperty(d)) { + input = $("#node-config-input-"+d); + if (input.attr('type') === "checkbox") { + configNode[d] = input.prop('checked'); + } else { + configNode[d] = input.val(); + } + } + } + configNode.label = configTypeDef.label; + configNode._def = configTypeDef; + RED.nodes.add(configNode); + updateConfigNodeSelect(configProperty,configType,configNode.id); + } else { + configNode = RED.nodes.node(configId); + for (d in configTypeDef.defaults) { + if (configTypeDef.defaults.hasOwnProperty(d)) { + input = $("#node-config-input-"+d); + if (input.attr('type') === "checkbox") { + configNode[d] = input.prop('checked'); + } else { + configNode[d] = input.val(); + } + } + } + updateConfigNodeSelect(configProperty,configType,configId); + } + if (configTypeDef.credentials) { + updateNodeCredentials(configNode,configTypeDef.credentials,"node-config-input"); + } + if (configTypeDef.oneditsave) { + configTypeDef.oneditsave.call(RED.nodes.node(configId)); + } + validateNode(configNode); + for (var i=0;i'+ '
    '+ ''+ - ''+ - ''+ - ''+ - ''+ + ''+ + ''+ + ''+ + ''+ ''+ - ''+ - ''+ + ''+ + ''+ '
    Ctrl/⌘ + aSelect all nodes
    Shift + ClickSelect all connected nodes
    Ctrl/⌘ + ClickAdd/remove node from selection
    DeleteDelete selected nodes or link
    Ctrl/⌘ + a'+RED._("keyboard.selectAll")+'
    Shift + Click'+RED._("keyboard.selectAllConnected")+'
    Ctrl/⌘ + Click'+RED._("keyboard.addRemoveNode")+'
    Delete'+RED._("keyboard.deleteSelected")+'
     
    Ctrl/⌘ + iImport nodes
    Ctrl/⌘ + eExport selected nodes
    Ctrl/⌘ + i'+RED._("keyboard.importNode")+'
    Ctrl/⌘ + e'+RED._("keyboard.exportNode")+'
    '+ '
    '+ '
    '+ ''+ - ''+ + ''+ ''+ - ''+ + ''+ ''+ - ''+ - ''+ - ''+ + ''+ + ''+ + ''+ '
    Ctrl/⌘ + SpaceToggle sidebar
    Ctrl/⌘ + Space'+RED._("keyboard.toggleSidebar")+'
    DeleteDelete selected nodes or link
    Delete'+RED._("keyboard.deleteNode")+'
    Ctrl/⌘ + cCopy selected nodes
    Ctrl/⌘ + xCut selected nodes
    Ctrl/⌘ + vPaste nodes
    Ctrl/⌘ + c'+RED._("keyboard.copyNode")+'
    Ctrl/⌘ + x'+RED._("keyboard.cutNode")+'
    Ctrl/⌘ + v'+RED._("keyboard.pasteNode")+'
    '+ '
    '+ '') diff --git a/editor/js/ui/library.js b/editor/js/ui/library.js index 7a98025f1..af36da8cb 100644 --- a/editor/js/ui/library.js +++ b/editor/js/ui/library.js @@ -14,8 +14,8 @@ * limitations under the License. **/ RED.library = (function() { - - + + function loadFlowLibrary() { $.getJSON("library/flows",function(data) { //console.log(data); @@ -66,12 +66,12 @@ RED.library = (function() { $("#menu-item-import-library-submenu").replaceWith(menu); }); } - + function createUI(options) { var libraryData = {}; var selectedLibraryItem = null; var libraryEditor = null; - + // Orion editor has set/getText // ACE editor has set/getValue // normalise to set/getValue @@ -84,14 +84,14 @@ RED.library = (function() { if (options.editor.getText) { options.editor.getValue = options.editor.getText; } - + function buildFileListItem(item) { var li = document.createElement("li"); li.onmouseover = function(e) { $(this).addClass("list-hover"); }; li.onmouseout = function(e) { $(this).removeClass("list-hover"); }; return li; } - + function buildFileList(root,data) { var ul = document.createElement("ul"); var li; @@ -104,7 +104,7 @@ RED.library = (function() { var dirName = v; return function(e) { var bcli = $('
  • / '+dirName+'
  • '); - $("a",bcli).click(function(e) { + $("a",bcli).click(function(e) { $(this).parent().nextAll().remove(); $.getJSON("library/"+options.url+root+dirName,function(data) { $("#node-select-library").children().first().replaceWith(buildFileList(root+dirName+"/",data)); @@ -141,24 +141,24 @@ RED.library = (function() { } return ul; } - + $('#node-input-name').addClass('input-append-left').css("width","65%").after( '' ); - - - + + + $('#node-input-'+options.type+'-menu-open-library').click(function(e) { $("#node-select-library").children().remove(); var bc = $("#node-dialog-library-breadcrumbs"); bc.children().first().nextAll().remove(); libraryEditor.setValue('',-1); - + $.getJSON("library/"+options.url,function(data) { $("#node-select-library").append(buildFileList("/",data)); $("#node-dialog-library-breadcrumbs a").click(function(e) { @@ -168,10 +168,10 @@ RED.library = (function() { }); $( "#node-dialog-library-lookup" ).dialog( "open" ); }); - + e.preventDefault(); }); - + $('#node-input-'+options.type+'-menu-save-library').click(function(e) { //var found = false; var name = $("#node-input-name").val().replace(/(^\s*)|(\s*$)/g,""); @@ -217,7 +217,7 @@ RED.library = (function() { $( "#node-dialog-library-save" ).dialog( "open" ); e.preventDefault(); }); - + libraryEditor = ace.edit('node-select-library-text'); libraryEditor.setTheme("ace/theme/tomorrow"); if (options.mode) { @@ -230,16 +230,16 @@ RED.library = (function() { }); libraryEditor.renderer.$cursorLayer.element.style.opacity=0; libraryEditor.$blockScrolling = Infinity; - + $( "#node-dialog-library-lookup" ).dialog({ - title: options.type+" library", + title: RED._("library.typeLibrary", {type:options.type}), modal: true, autoOpen: false, width: 800, height: 450, buttons: [ { - text: "Ok", + text: RED._("common.label.ok"), click: function() { if (selectedLibraryItem) { for (var i=0;i'+ - '
    '+category.replace("_"," ")+'
    '+ + '
    '+label+'
    '+ '
    '+ '
    '+ '
    '+ @@ -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;iCannot 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 += ''; + table += ''; if (node.type != "subflow" && node.name) { - table += ""; + table += ""; } - table += ""; - table += ""; - + table += ""; + table += ""; + var m = /^subflow(:(.+))?$/.exec(node.type); if (m) { var subflowNode; @@ -75,9 +75,9 @@ RED.sidebar.info = (function() { } else { subflowNode = node; } - - table += ''; - + + table += ''; + var userCount = 0; var subflowType = "subflow:"+subflowNode.id; RED.nodes.eachNode(function(n) { @@ -85,12 +85,12 @@ RED.sidebar.info = (function() { userCount++; } }); - table += ""; - table += ""; + table += ""; + table += ""; } - + 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 += '"; } } @@ -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 (iLogin failed'+ - (opts.cancelable?'Cancel':'')+ - '
    ').appendTo("#node-dialog-login-fields"); - - + $('
    '+RED._("user.loginFailed")+''+ + (opts.cancelable?''+RED._("common.label.cancel")+'':'')+ + '
    ').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 @@
    -
    Drop the flow here
    +

    - +
    @@ -95,26 +95,19 @@
    -
    - Some of the nodes are not properly configured. Are you sure you want to deploy? -
    -
    - The workspace contains some unknown node types: +
    +
      - Are you sure you want to deploy?
      -
      - The workspace contains some unused configuration nodes: +
        - Are you sure you want to deploy?
        -
        - A called already exists. Overwrite? +
        @@ -122,12 +115,12 @@
        - - + +
        - - + +
        @@ -136,7 +129,7 @@
        @@ -152,30 +145,29 @@
        - +
        -
        - Are you sure you want to delete ''? +
        diff --git a/editor/vendor/i18next/i18next.min.js b/editor/vendor/i18next/i18next.min.js new file mode 100644 index 000000000..3ba215ddb --- /dev/null +++ b/editor/vendor/i18next/i18next.min.js @@ -0,0 +1,5 @@ +// i18next, v1.8.1 +// Copyright (c)2015 Jan Mühlemann (jamuhl). +// Distributed under MIT license +// http://i18next.com +!function(a){function b(a,b){if(!b||"function"==typeof b)return a;for(var c in b)a[c]=b[c];return a}function c(a,b){for(var d in b)d in a?c(a[d],b[d]):a[d]=b[d];return a}function d(a,b,c){var d,e=0,f=a.length,g=void 0===f||"[object Array]"!==Object.prototype.toString.apply(a)||"function"==typeof a;if(c)if(g){for(d in a)if(b.apply(a[d],c)===!1)break}else for(;f>e&&b.apply(a[e++],c)!==!1;);else if(g){for(d in a)if(b.call(a[d],d,a[d])===!1)break}else for(;f>e&&b.call(a[e],e,a[e++])!==!1;);return a}function e(a){return"string"==typeof a?a.replace(/[&<>"'\/]/g,function(a){return Q[a]}):a}function f(a){var b=function(a){if(window.XMLHttpRequest)return a(null,new XMLHttpRequest);if(window.ActiveXObject)try{return a(null,new ActiveXObject("Msxml2.XMLHTTP"))}catch(b){return a(null,new ActiveXObject("Microsoft.XMLHTTP"))}return a(new Error)},c=function(a){if("string"==typeof a)return a;var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b.join("&")},d=function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0;cd?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b},e=function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a=d(a);var c,e,f,g,h,i,j,k="",l=0;do c=a.charCodeAt(l++),e=a.charCodeAt(l++),f=a.charCodeAt(l++),g=c>>2,h=(3&c)<<4|e>>4,i=(15&e)<<2|f>>6,j=63&f,isNaN(e)?i=j=64:isNaN(f)&&(j=64),k+=b.charAt(g)+b.charAt(h)+b.charAt(i)+b.charAt(j),c=e=f="",g=h=i=j="";while(l1&&(d+=d.indexOf("?")>-1?"&"+k:"?"+k),e.jsonp){var l=document.getElementsByTagName("head")[0],m=document.createElement("script");return m.type="text/javascript",m.src=d,void l.appendChild(m)}}b(function(b,c){if(b)return h(b);c.open(a,d,e.async);for(var f in j)j.hasOwnProperty(f)&&c.setRequestHeader(f,j[f]);c.onreadystatechange=function(){if(4===c.readyState){var a=c.responseText||"";if(!h)return;h(c.status,{text:function(){return a},json:function(){try{return JSON.parse(a)}catch(b){return T.error("Can not parse JSON. URL: "+d),{}}}})}},c.send(i)})},h={authBasic:function(a,b){g.headers.Authorization="Basic "+e(a+":"+b)},connect:function(a,b,c){return g("CONNECT",a,b,c)},del:function(a,b,c){return g("DELETE",a,b,c)},get:function(a,b,c){return g("GET",a,b,c)},head:function(a,b,c){return g("HEAD",a,b,c)},headers:function(a){g.headers=a||{}},isAllowed:function(a,b,c){this.options(a,function(a,d){c(-1!==d.text().indexOf(b))})},options:function(a,b,c){return g("OPTIONS",a,b,c)},patch:function(a,b,c){return g("PATCH",a,b,c)},post:function(a,b,c){return g("POST",a,b,c)},put:function(a,b,c){return g("PUT",a,b,c)},trace:function(a,b,c){return g("TRACE",a,b,c)}},i=a.type?a.type.toLowerCase():"get";h[i](a.url,a,function(b,c){200===b||0===b&&c.text()?a.success(c.json(),b,null):a.error(c.text(),b,null)})}function g(a,b){"function"==typeof a&&(b=a,a={}),a=a||{},T.extend(P,a),delete P.fixLng,P.functions&&(delete P.functions,T.extend(T,a.functions)),"string"==typeof P.ns&&(P.ns={namespaces:[P.ns],defaultNs:P.ns}),"string"==typeof P.fallbackNS&&(P.fallbackNS=[P.fallbackNS]),("string"==typeof P.fallbackLng||"boolean"==typeof P.fallbackLng)&&(P.fallbackLng=[P.fallbackLng]),P.interpolationPrefixEscaped=T.regexEscape(P.interpolationPrefix),P.interpolationSuffixEscaped=T.regexEscape(P.interpolationSuffix),P.lng||(P.lng=T.detectLanguage()),M=T.toLanguages(P.lng),H=M[0],T.log("currentLng set to: "+H),P.useCookie&&T.cookie.read(P.cookieName)!==H&&T.cookie.create(P.cookieName,H,P.cookieExpirationTime,P.cookieDomain),P.detectLngFromLocalStorage&&"undefined"!=typeof document&&window.localStorage&&T.localStorage.setItem("i18next_lng",H);var c=B;a.fixLng&&(c=function(a,b){return b=b||{},b.lng=b.lng||c.lng,B(a,b)},c.lng=H),W.setCurrentLng(H),I&&P.setJqueryExt&&u();var d;if(I&&I.Deferred&&(d=I.Deferred()),!P.resStore){var e=T.toLanguages(P.lng);"string"==typeof P.preload&&(P.preload=[P.preload]);for(var f=0,g=P.preload.length;g>f;f++)for(var h=T.toLanguages(P.preload[f]),i=0,j=h.length;j>i;i++)e.indexOf(h[i])<0&&e.push(h[i]);return J.sync.load(e,P,function(a,e){K=e,N=!0,b&&b(c),d&&d.resolve(c)}),d?d.promise():void 0}return K=P.resStore,N=!0,b&&b(c),d&&d.resolve(c),d?d.promise():void 0}function h(a,b){"string"==typeof a&&(a=[a]);for(var c=0,d=a.length;d>c;c++)P.preload.indexOf(a[c])<0&&P.preload.push(a[c]);return g(b)}function i(a,b,c,d){"string"!=typeof b?(c=b,b=P.ns.defaultNs):P.ns.namespaces.indexOf(b)<0&&P.ns.namespaces.push(b),K[a]=K[a]||{},K[a][b]=K[a][b]||{},d?T.deepExtend(K[a][b],c):T.extend(K[a][b],c),P.useLocalStorage&&O._storeLocal(K)}function j(a,b){"string"!=typeof b&&(b=P.ns.defaultNs),K[a]=K[a]||{};var c=K[a][b]||{},d=!1;for(var e in c)c.hasOwnProperty(e)&&(d=!0);return d}function k(a,b){return"string"!=typeof b&&(b=P.ns.defaultNs),K[a]=K[a]||{},T.extend({},K[a][b])}function l(a,b){"string"!=typeof b&&(b=P.ns.defaultNs),K[a]=K[a]||{},K[a][b]={},P.useLocalStorage&&O._storeLocal(K)}function m(a,b,c,d){"string"!=typeof b?(resource=b,b=P.ns.defaultNs):P.ns.namespaces.indexOf(b)<0&&P.ns.namespaces.push(b),K[a]=K[a]||{},K[a][b]=K[a][b]||{};for(var e=c.split(P.keyseparator),f=0,g=K[a][b];e[f];)f==e.length-1?g[e[f]]=d:(null==g[e[f]]&&(g[e[f]]={}),g=g[e[f]]),f++;P.useLocalStorage&&O._storeLocal(K)}function n(a,b,c){"string"!=typeof b?(resource=b,b=P.ns.defaultNs):P.ns.namespaces.indexOf(b)<0&&P.ns.namespaces.push(b);for(var d in c)"string"==typeof c[d]&&m(a,b,d,c[d])}function o(a){P.ns.defaultNs=a}function p(a,b){q([a],b)}function q(a,b){var c={dynamicLoad:P.dynamicLoad,resGetPath:P.resGetPath,getAsync:P.getAsync,customLoad:P.customLoad,ns:{namespaces:a,defaultNs:""}},d=T.toLanguages(P.lng);"string"==typeof P.preload&&(P.preload=[P.preload]);for(var e=0,f=P.preload.length;f>e;e++)for(var g=T.toLanguages(P.preload[e]),h=0,i=g.length;i>h;h++)d.indexOf(g[h])<0&&d.push(g[h]);for(var j=[],k=0,l=d.length;l>k;k++){var m=!1,n=K[d[k]];if(n)for(var o=0,p=a.length;p>o;o++)n[a[o]]||(m=!0);else m=!0;m&&j.push(d[k])}j.length?J.sync._fetch(j,c,function(c,d){var e=a.length*j.length;T.each(a,function(a,c){P.ns.namespaces.indexOf(c)<0&&P.ns.namespaces.push(c),T.each(j,function(a,f){K[f]=K[f]||{},K[f][c]=d[f][c],e--,0===e&&b&&(P.useLocalStorage&&J.sync._storeLocal(K),b())})})}):b&&b()}function r(a,b,c){return"function"==typeof b?(c=b,b={}):b||(b={}),b.lng=a,g(b,c)}function s(){return H}function t(a){K={},r(H,a)}function u(){function a(a,b,c){if(0!==b.length){var d="text";if(0===b.indexOf("[")){var e=b.split("]");b=e[1],d=e[0].substr(1,e[0].length-1)}b.indexOf(";")===b.length-1&&(b=b.substr(0,b.length-2));var f;if("html"===d)f=P.defaultValueFromContent?I.extend({defaultValue:a.html()},c):c,a.html(I.t(b,f));else if("text"===d)f=P.defaultValueFromContent?I.extend({defaultValue:a.text()},c):c,a.text(I.t(b,f));else if("prepend"===d)f=P.defaultValueFromContent?I.extend({defaultValue:a.html()},c):c,a.prepend(I.t(b,f));else if("append"===d)f=P.defaultValueFromContent?I.extend({defaultValue:a.html()},c):c,a.append(I.t(b,f));else if(0===d.indexOf("data-")){var g=d.substr("data-".length);f=P.defaultValueFromContent?I.extend({defaultValue:a.data(g)},c):c;var h=I.t(b,f);a.data(g,h),a.attr(d,h)}else f=P.defaultValueFromContent?I.extend({defaultValue:a.attr(d)},c):c,a.attr(d,I.t(b,f))}}function b(b,c){var d=b.attr(P.selectorAttr);if(d||"undefined"==typeof d||d===!1||(d=b.text()||b.val()),d){var e=b,f=b.data("i18n-target");if(f&&(e=b.find(f)||b),c||P.useDataAttrOptions!==!0||(c=b.data("i18n-options")),c=c||{},d.indexOf(";")>=0){var g=d.split(";");I.each(g,function(b,d){""!==d&&a(e,d,c)})}else a(e,d,c);P.useDataAttrOptions===!0&&b.data("i18n-options",c)}}I.t=I.t||B,I.fn.i18n=function(a){return this.each(function(){b(I(this),a);var c=I(this).find("["+P.selectorAttr+"]");c.each(function(){b(I(this),a)})})}}function v(a,b,c,d){if(!a)return a;if(d=d||b,a.indexOf(d.interpolationPrefix||P.interpolationPrefix)<0)return a;var e=d.interpolationPrefix?T.regexEscape(d.interpolationPrefix):P.interpolationPrefixEscaped,f=d.interpolationSuffix?T.regexEscape(d.interpolationSuffix):P.interpolationSuffixEscaped,g="HTML"+f,h=b.replace&&"object"==typeof b.replace?b.replace:b;return T.each(h,function(b,h){var i=c?c+P.keyseparator+b:b;"object"==typeof h&&null!==h?a=v(a,h,i,d):d.escapeInterpolation||P.escapeInterpolation?(a=a.replace(new RegExp([e,i,g].join(""),"g"),T.regexReplacementEscape(h)),a=a.replace(new RegExp([e,i,f].join(""),"g"),T.regexReplacementEscape(T.escape(h)))):a=a.replace(new RegExp([e,i,f].join(""),"g"),T.regexReplacementEscape(h))}),a}function w(a,b){var c=",",d="{",e="}",f=T.extend({},b);for(delete f.postProcess;-1!=a.indexOf(P.reusePrefix)&&(L++,!(L>P.maxRecursion));){var g=a.lastIndexOf(P.reusePrefix),h=a.indexOf(P.reuseSuffix,g)+P.reuseSuffix.length,i=a.substring(g,h),j=i.replace(P.reusePrefix,"").replace(P.reuseSuffix,"");if(g>=h)return T.error("there is an missing closing in following translation value",a),"";if(-1!=j.indexOf(c)){var k=j.indexOf(c);if(-1!=j.indexOf(d,k)&&-1!=j.indexOf(e,k)){var l=j.indexOf(d,k),m=j.indexOf(e,l)+e.length;try{f=T.extend(f,JSON.parse(j.substring(l,m))),j=j.substring(0,k)}catch(n){}}}var o=E(j,f);a=a.replace(i,T.regexReplacementEscape(o))}return a}function x(a){return a.context&&("string"==typeof a.context||"number"==typeof a.context)}function y(a){return void 0!==a.count&&"string"!=typeof a.count}function z(a){return void 0!==a.indefinite_article&&"string"!=typeof a.indefinite_article&&a.indefinite_article}function A(a,b){b=b||{};var c=C(a,b),d=F(a,b);return void 0!==d||d===c}function B(a,b){return b=b||{},N?(L=0,E.apply(null,arguments)):(T.log("i18next not finished initialization. you might have called t function before loading resources finished."),b.defaultValue||"")}function C(a,b){return void 0!==b.defaultValue?b.defaultValue:a}function D(){for(var a=[],b=1;b1)for(var d=0;d-1&&(e=c.split(P.nsseparator),i=e[0],c=e[1]),void 0===g&&P.sendMissing&&"function"==typeof P.missingKeyHandler&&(b.lng?P.missingKeyHandler(h[0],i,c,f,h):P.missingKeyHandler(P.lng,i,c,f,h));var j;j="string"==typeof P.postProcess&&""!==P.postProcess?[P.postProcess]:"array"==typeof P.postProcess||"object"==typeof P.postProcess?P.postProcess:[],"string"==typeof b.postProcess&&""!==b.postProcess?j=j.concat([b.postProcess]):("array"==typeof b.postProcess||"object"==typeof b.postProcess)&&(j=j.concat(b.postProcess)),void 0!==g&&j.length&&j.forEach(function(a){X[a]&&(g=X[a](g,c,b))});var k=f;if(f.indexOf(P.nsseparator)>-1&&(e=f.split(P.nsseparator),k=e[1]),k===c&&P.parseMissingKey&&(f=P.parseMissingKey(f)),void 0===g&&(f=v(f,b),f=w(f,b),j.length)){var l=C(c,b);j.forEach(function(a){X[a]&&(g=X[a](l,c,b))})}return void 0!==g?g:f}function F(a,b){b=b||{};var c,d,e=C(a,b),f=M;if(!K)return e;if("cimode"===f[0].toLowerCase())return e;if(b.lngs&&(f=b.lngs),b.lng&&(f=T.toLanguages(b.lng,b.fallbackLng),!K[f[0]])){var g=P.getAsync;P.getAsync=!1,J.sync.load(f,P,function(a,b){T.extend(K,b),P.getAsync=g})}var h=b.ns||P.ns.defaultNs;if(a.indexOf(P.nsseparator)>-1){var i=a.split(P.nsseparator);h=i[0],a=i[1]}if(x(b)){c=T.extend({},b),delete c.context,c.defaultValue=P.contextNotFound;var j=h+P.nsseparator+a+"_"+b.context;if(d=B(j,c),d!=P.contextNotFound)return v(d,{context:b.context})}if(y(b,f[0])){c=T.extend({lngs:[f[0]]},b),delete c.count,c._origLng=c._origLng||c.lng||f[0],delete c.lng,c.defaultValue=P.pluralNotFound;var k;if(W.needsPlural(f[0],b.count)){k=h+P.nsseparator+a+P.pluralSuffix;var l=W.get(f[0],b.count);l>=0?k=k+"_"+l:1===l&&(k=h+P.nsseparator+a)}else k=h+P.nsseparator+a;if(d=B(k,c),d!=P.pluralNotFound)return v(d,{count:b.count,interpolationPrefix:b.interpolationPrefix,interpolationSuffix:b.interpolationSuffix});if(!(f.length>1))return c.lng=c._origLng,delete c._origLng,d=B(h+P.nsseparator+a,c),v(d,{count:b.count,interpolationPrefix:b.interpolationPrefix,interpolationSuffix:b.interpolationSuffix});var m=f.slice();if(m.shift(),b=T.extend(b,{lngs:m}),b._origLng=c._origLng,delete b.lng,d=B(h+P.nsseparator+a,b),d!=P.pluralNotFound)return d}if(z(b)){var n=T.extend({},b);delete n.indefinite_article,n.defaultValue=P.indefiniteNotFound;var o=h+P.nsseparator+a+(b.count&&!y(b,f[0])||!b.count?P.indefiniteSuffix:"");if(d=B(o,n),d!=P.indefiniteNotFound)return d}for(var p,q=a.split(P.keyseparator),r=0,s=f.length;s>r&&void 0===p;r++){for(var t=f[r],u=0,A=K[t]&&K[t][h];q[u];)A=A&&A[q[u]],u++;if(void 0!==A){var D=Object.prototype.toString.apply(A);if("string"==typeof A)A=v(A,b),A=w(A,b);else if("[object Array]"!==D||P.returnObjectTrees||b.returnObjectTrees){if(null===A&&P.fallbackOnNull===!0)A=void 0;else if(null!==A)if(P.returnObjectTrees||b.returnObjectTrees){if("[object Number]"!==D&&"[object Function]"!==D&&"[object RegExp]"!==D){var G="[object Array]"===D?[]:{};T.each(A,function(c){G[c]=E(h+P.nsseparator+a+P.keyseparator+c,b)}),A=G}}else P.objectTreeKeyHandler&&"function"==typeof P.objectTreeKeyHandler?A=P.objectTreeKeyHandler(a,A,t,h,b):(A="key '"+h+":"+a+" ("+t+")' returned an object instead of string.",T.log(A))}else A=A.join("\n"),A=v(A,b),A=w(A,b);"string"==typeof A&&""===A.trim()&&P.fallbackOnEmpty===!0&&(A=void 0),p=A}}if(void 0===p&&!b.isFallbackLookup&&(P.fallbackToDefaultNS===!0||P.fallbackNS&&P.fallbackNS.length>0)){if(b.isFallbackLookup=!0,P.fallbackNS.length){for(var H=0,I=P.fallbackNS.length;I>H;H++)if(p=F(P.fallbackNS[H]+P.nsseparator+a,b),p||""===p&&P.fallbackOnEmpty===!1){var L=p.indexOf(P.nsseparator)>-1?p.split(P.nsseparator)[1]:p,N=e.indexOf(P.nsseparator)>-1?e.split(P.nsseparator)[1]:e;if(L!==N)break}}else p=F(a,b);b.isFallbackLookup=!1}return p}function G(){var a,b=P.lngWhitelist||[],c=[];if("undefined"!=typeof window&&!function(){for(var a=window.location.search.substring(1),b=a.split("&"),d=0;d0){var f=b[d].substring(0,e);f==P.detectLngQS&&c.push(b[d].substring(e+1))}}}(),P.useCookie&&"undefined"!=typeof document){var d=T.cookie.read(P.cookieName);d&&c.push(d)}if(P.detectLngFromLocalStorage&&"undefined"!=typeof window&&window.localStorage&&c.push(T.localStorage.getItem("i18next_lng")),"undefined"!=typeof navigator){if(navigator.languages)for(var e=0;e-1){var f=e.split("-");e=P.lowerCaseLng?f[0].toLowerCase()+"-"+f[1].toLowerCase():f[0].toLowerCase()+"-"+f[1].toUpperCase()}if(0===b.length||b.indexOf(e)>-1){a=e;break}}}(),a||(a=P.fallbackLng[0]),a}Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>0&&(d=Number(arguments[1]),d!=d?d=0:0!=d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(a){"use strict";if(null==this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=c;arguments.length>1&&(d=Number(arguments[1]),d!=d?d=0:0!=d&&d!=1/0&&d!=-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d))));for(var e=d>=0?Math.min(d,c-1):c-Math.abs(d);e>=0;e--)if(e in b&&b[e]===a)return e;return-1}),"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var H,I=a.jQuery||a.Zepto,J={},K={},L=0,M=[],N=!1,O={};"undefined"!=typeof module&&module.exports?module.exports=J:(I&&(I.i18n=I.i18n||J),a.i18n=a.i18n||J),O={load:function(a,b,c){b.useLocalStorage?O._loadLocal(a,b,function(d,e){for(var f=[],g=0,h=a.length;h>g;g++)e[a[g]]||f.push(a[g]);f.length>0?O._fetch(f,b,function(a,b){T.extend(e,b),O._storeLocal(b),c(null,e)}):c(null,e)}):O._fetch(a,b,function(a,b){c(null,b)})},_loadLocal:function(a,b,c){var d={},e=(new Date).getTime();if(window.localStorage){var f=a.length;T.each(a,function(a,g){var h=T.localStorage.getItem("res_"+g);h&&(h=JSON.parse(h),h.i18nStamp&&h.i18nStamp+b.localStorageExpirationTime>e&&(d[g]=h)),f--,0===f&&c(null,d)})}},_storeLocal:function(a){if(window.localStorage)for(var b in a)a[b].i18nStamp=(new Date).getTime(),T.localStorage.setItem("res_"+b,JSON.stringify(a[b]))},_fetch:function(a,b,c){var d=b.ns,e={};if(b.dynamicLoad){var f=function(a,b){c(null,b)};if("function"==typeof b.customLoad)b.customLoad(a,d.namespaces,b,f);else{var g=v(b.resGetPath,{lng:a.join("+"),ns:d.namespaces.join("+")});T.ajax({url:g,success:function(a){T.log("loaded: "+g),f(null,a)},error:function(a,b,c){T.log("failed loading: "+g),f("failed loading resource.json error: "+c)},dataType:"json",async:b.getAsync})}}else{var h,i=d.namespaces.length*a.length;T.each(d.namespaces,function(d,f){T.each(a,function(a,d){var g=function(a,b){a&&(h=h||[],h.push(a)),e[d]=e[d]||{},e[d][f]=b,i--,0===i&&c(h,e)};"function"==typeof b.customLoad?b.customLoad(d,f,b,g):O._fetchOne(d,f,b,g)})})}},_fetchOne:function(a,b,c,d){var e=v(c.resGetPath,{lng:a,ns:b});T.ajax({url:e,success:function(a){T.log("loaded: "+e),d(null,a)},error:function(a,b,c){if(b&&200==b||a&&a.status&&200==a.status)T.error("There is a typo in: "+e);else if(b&&404==b||a&&a.status&&404==a.status)T.log("Does not exist: "+e);else{var f=b?b:a&&a.status?a.status:null;T.log(f+" when loading "+e)}d(c,{})},dataType:"json",async:c.getAsync})},postMissing:function(a,b,c,d,e){var f={};f[c]=d;var g=[];if("fallback"===P.sendMissingTo&&P.fallbackLng[0]!==!1)for(var h=0;hh;h++)g.push({lng:e[h],url:v(P.resPostPath,{lng:e[h],ns:b})});for(var j=0,k=g.length;k>j;j++){var l=g[j];T.ajax({url:l.url,type:P.sendType,data:f,success:function(){T.log("posted missing key '"+c+"' to: "+l.url);for(var a=c.split("."),e=0,f=K[l.lng][b];a[e];)f=f[a[e]]=e===a.length-1?d:f[a[e]]||{},e++},error:function(){T.log("failed posting missing key '"+c+"' to: "+l.url)},dataType:"json",async:P.postAsync})}},reload:t};var P={lng:void 0,load:"all",preload:[],lowerCaseLng:!1,returnObjectTrees:!1,fallbackLng:["dev"],fallbackNS:[],detectLngQS:"setLng",detectLngFromLocalStorage:!1,ns:"translation",fallbackOnNull:!0,fallbackOnEmpty:!1,fallbackToDefaultNS:!1,nsseparator:":",keyseparator:".",selectorAttr:"data-i18n",debug:!1,resGetPath:"locales/__lng__/__ns__.json",resPostPath:"locales/add/__lng__/__ns__",getAsync:!0,postAsync:!0,resStore:void 0,useLocalStorage:!1,localStorageExpirationTime:6048e5,dynamicLoad:!1,sendMissing:!1,sendMissingTo:"fallback",sendType:"POST",interpolationPrefix:"__",interpolationSuffix:"__",defaultVariables:!1,reusePrefix:"$t(",reuseSuffix:")",pluralSuffix:"_plural",pluralNotFound:["plural_not_found",Math.random()].join(""),contextNotFound:["context_not_found",Math.random()].join(""),escapeInterpolation:!1,indefiniteSuffix:"_indefinite",indefiniteNotFound:["indefinite_not_found",Math.random()].join(""),setJqueryExt:!0,defaultValueFromContent:!0,useDataAttrOptions:!1,cookieExpirationTime:void 0,useCookie:!0,cookieName:"i18next",cookieDomain:void 0,objectTreeKeyHandler:void 0,postProcess:void 0,parseMissingKey:void 0,missingKeyHandler:O.postMissing,shortcutFunction:"sprintf"},Q={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},R={create:function(a,b,c,d){var e;if(c){var f=new Date;f.setTime(f.getTime()+60*c*1e3),e="; expires="+f.toGMTString()}else e="";d=d?"domain="+d+";":"",document.cookie=a+"="+b+e+";"+d+"path=/"},read:function(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d-1){var c=a.split("-");b=P.lowerCaseLng?c[0].toLowerCase()+"-"+c[1].toLowerCase():c[0].toLowerCase()+"-"+c[1].toUpperCase()}else b=P.lowerCaseLng?a.toLowerCase():a;return b}var c=this.log,d=[],e=P.lngWhitelist||!1,f=function(a){!e||e.indexOf(a)>-1?d.push(a):c("rejecting non-whitelisted language: "+a)};if("string"==typeof a&&a.indexOf("-")>-1){var g=a.split("-");"unspecific"!==P.load&&f(b(a)),"current"!==P.load&&f(b(g[this.getCountyIndexOfLng(a)]))}else f(b(a));for(var h=0;h1)},2:function(a){return Number(1!=a)},3:function(){return 0},4:function(a){return Number(a%10==1&&a%100!=11?0:a%10>=2&&4>=a%10&&(10>a%100||a%100>=20)?1:2)},5:function(a){return Number(0===a?0:1==a?1:2==a?2:a%100>=3&&10>=a%100?3:a%100>=11?4:5)},6:function(a){return Number(1==a?0:a>=2&&4>=a?1:2)},7:function(a){return Number(1==a?0:a%10>=2&&4>=a%10&&(10>a%100||a%100>=20)?1:2)},8:function(a){return Number(1==a?0:2==a?1:8!=a&&11!=a?2:3)},9:function(a){return Number(a>=2)},10:function(a){return Number(1==a?0:2==a?1:7>a?2:11>a?3:4)},11:function(a){return Number(1==a||11==a?0:2==a||12==a?1:a>2&&20>a?2:3)},12:function(a){return Number(a%10!=1||a%100==11)},13:function(a){return Number(0!==a)},14:function(a){return Number(1==a?0:2==a?1:3==a?2:3)},15:function(a){return Number(a%10==1&&a%100!=11?0:a%10>=2&&(10>a%100||a%100>=20)?1:2)},16:function(a){return Number(a%10==1&&a%100!=11?0:0!==a?1:2)},17:function(a){return Number(1==a||a%10==1?0:1)},18:function(a){return Number(1==a?1:2)},19:function(a){return Number(1==a?0:0===a||a%100>1&&11>a%100?1:a%100>10&&20>a%100?2:3)},20:function(a){return Number(1==a?0:0===a||a%100>0&&20>a%100?1:2)},21:function(a){return Number(a%100==1?1:a%100==2?2:a%100==3||a%100==4?3:0)}},W={rules:function(){var a,b={};for(a=U.length;a--;)b[U[a][0]]={name:U[a][1],numbers:U[a][2],plurals:V[U[a][3]]};return b}(),addRule:function(a,b){W.rules[a]=b},setCurrentLng:function(a){if(!W.currentRule||W.currentRule.lng!==a){var b=a.split("-");W.currentRule={lng:a,rule:W.rules[b[0]]}}},needsPlural:function(a,b){var c,d=a.split("-");return c=W.currentRule&&W.currentRule.lng===a?W.currentRule.rule:W.rules[d[T.getCountyIndexOfLng(a)]],c&&c.numbers.length<=1?!1:1!==this.get(a,b)},get:function(a,b){function c(b,c){var d;if(d=W.currentRule&&W.currentRule.lng===a?W.currentRule.rule:W.rules[b]){var e;e=d.plurals(d.noAbs?c:Math.abs(c));var f=d.numbers[e];return 2===d.numbers.length&&1===d.numbers[0]&&(2===f?f=-1:1===f&&(f=1)),f}return 1===c?"1":"-1"}var d=a.split("-");return c(d[T.getCountyIndexOfLng(a)],b)}},X={},Y=function(a,b){X[a]=b},Z=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}function b(a,b){for(var c=[];b>0;c[--b]=a);return c.join("")}var c=function(){return c.cache.hasOwnProperty(arguments[0])||(c.cache[arguments[0]]=c.parse(arguments[0])),c.format.call(null,c.cache[arguments[0]],arguments)};return c.format=function(c,d){var e,f,g,h,i,j,k,l=1,m=c.length,n="",o=[];for(f=0;m>f;f++)if(n=a(c[f]),"string"===n)o.push(c[f]);else if("array"===n){if(h=c[f],h[2])for(e=d[l],g=0;g=0?"+"+e:e,j=h[4]?"0"==h[4]?"0":h[4].charAt(1):" ",k=h[6]-String(e).length,i=h[6]?b(j,k):"",o.push(h[5]?e+i:i+e)}return o.join("")},c.cache={},c.parse=function(a){for(var b=a,c=[],d=[],e=0;b;){if(null!==(c=/^[^\x25]+/.exec(b)))d.push(c[0]);else if(null!==(c=/^\x25{2}/.exec(b)))d.push("%");else{if(null===(c=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(b)))throw"[sprintf] huh?";if(c[2]){e|=1;var f=[],g=c[2],h=[];if(null===(h=/^([a-z_][a-z_\d]*)/i.exec(g)))throw"[sprintf] huh?";for(f.push(h[1]);""!==(g=g.substring(h[0].length));)if(null!==(h=/^\.([a-z_][a-z_\d]*)/i.exec(g)))f.push(h[1]);else{if(null===(h=/^\[(\d+)\]/.exec(g)))throw"[sprintf] huh?";f.push(h[1])}c[2]=f}else e|=2;if(3===e)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";d.push(c)}b=b.substring(c[0].length)}return d},c}(),$=function(a,b){return b.unshift(a),Z.apply(null,b)};Y("sprintf",function(a,b,c){return c.sprintf?"[object Array]"===Object.prototype.toString.apply(c.sprintf)?$(a,c.sprintf):"object"==typeof c.sprintf?Z(a,c.sprintf):a:a}),J.init=g,J.setLng=r,J.preload=h,J.addResourceBundle=i,J.hasResourceBundle=j,J.getResourceBundle=k,J.addResource=m,J.addResources=n,J.removeResourceBundle=l,J.loadNamespace=p,J.loadNamespaces=q,J.setDefaultNamespace=o,J.t=B,J.translate=B,J.exists=A,J.detectLanguage=T.detectLanguage,J.pluralExtensions=W,J.sync=O,J.functions=T,J.lng=s,J.addPostProcessor=Y,J.applyReplacement=T.applyReplacement,J.options=P}("undefined"==typeof exports?window:exports); \ No newline at end of file diff --git a/locales/en-US/editor.json b/locales/en-US/editor.json new file mode 100644 index 000000000..5785dbe60 --- /dev/null +++ b/locales/en-US/editor.json @@ -0,0 +1,192 @@ +{ + "common": { + "label": { + "name": "Name", + "ok": "Ok", + "cancel": "Cancel", + "delete": "Delete", + "close": "Close" + } + }, + "workspace": { + "renameSheet": "Rename sheet", + "confirmDelete": "Confirm delete", + "delete": "Are you sure you want to delete '__label__'?", + "dropFlowHere": "Drop the flow here" + }, + "menu": { + "label": { + "sidebar": "Sidebar", + "displayStatus": "Display node status", + "import": "Import", + "export": "Export", + "clipboard": "Clipboard", + "library": "Library", + "configurationNodes": "Configuration nodes", + "subflows": "Subflows", + "createSubflow": "Create subflow", + "selectionToSubflow": "Selection to subflow", + "workspaces": "Workspaces", + "add": "Add", + "rename": "Rename", + "delete": "Delete", + "keyboardShortcuts": "Keyboard Shortcuts", + "login": "Login", + "logout": "Logout" + } + }, + "user": { + "loggedInAs": "Logged in as __name__", + "login": "Login", + "loginFailed": "Login failed" + }, + "notification": { + "warning": "Warning: __message__", + "warnings": { + "undeployedChanges": "node has undeployed changes", + "nodeActionDisabled": "node actions disabled within subflow" + }, + + "error": "Error: __message__", + "errors": { + "lostConnection": "Lost connection to server", + "cannotAddSubflowToItself": "Cannot add subflow to itself", + "cannotAddCircularReference": "Cannot add subflow - circular reference detected" + } + }, + "clipboard": { + "nodes": "Nodes:", + "selectNodes": "Select the text above and copy to the clipboard.", + "pasteNodes": "Paste nodes here", + "importNodes": "Import nodes", + "exportNodes": "Export nodes to clipboard", + "importUnrecognised": "Imported unrecognised type:", + "importUnrecognised_plural": "Imported unrecognised types:", + "nodeCopied": "__count__ node copied", + "nodeCopied_plural": "__count__ nodes copied", + "invalidFlow": "Invalid flow: __message__" + }, + "deploy": { + "deploy": "Deploy", + "full": "Full", + "fullDesc": "Deploys everything in the workspace", + "modifiedFlows": "Modified Flows", + "modifiedFlowsDesc": "Only deploys flows that contain changed nodes", + "modifiedNodes": "Modified Nodes", + "modifiedNodesDesc": "Only deploys nodes that have changed", + "successfulDeploy": "Successfully Deployed", + "errors": { + "noResponse": "no response from server" + }, + "confirm": { + "button": { + "confirm": "Confirm deploy", + "cancel": "Cancel" + }, + "undeployedChanges": "You have undeployed changes.\n\nLeaving this page will lose these changes.", + "improperlyConfigured": "Some of the nodes are not properly configured.", + "unknown": "The workspace contains some unknown node types:", + "unusedConfig": "The workspace contains some unused configuration nodes:", + "confirm": "Are you sure you want to deploy?" + } + }, + "subflow": { + "tabLabel": "Subflow: __name__", + "editSubflow": "Edit flow __name__", + "edit": "Edit flow", + "subflowInstances": "There is __count__ instance of this subflow", + "subflowInstances_plural": "There are __count__ instances of this subflow", + "editSubflowName": "edit name", + "input": "input", + "output": "output", + "deleteSubflow": "delete subflow", + "errors": { + "noNodesSelected": "Cannot create subflow: no nodes selected", + "multipleInputsToSelection": "Cannot create subflow: multiple inputs to selection" + } + }, + "editor": { + "configEdit": "edit", + "configAdd": "add", + "configDelete": "Delete", + "nodesUse": "__count__ node uses this config", + "nodesUse_plural": "__count__ nodes use this config", + "addNewConfig": "Add new __type__ config node", + "editConfig": "Edit __type__ config node", + "addNewType": "Add new __type__..." + }, + "keyboard": { + "selectAll": "Select all nodes", + "selectAllConnected": "Select all connected nodes", + "addRemoveNode": "Add/remove node from selection", + "deleteSelected": "Delete selected nodes or link", + "importNode": "Import nodes", + "exportNode": "Export selected nodes", + "toggleSidebar": "Toggle sidebar", + "deleteNode": "Delete selected nodes or link", + "copyNode": "Copy selected nodes", + "cutNode": "Cut selected nodes", + "pasteNode": "Paste nodes" + }, + "library": { + "openLibrary": "Open Library...", + "saveToLibrary": "Save to Library...", + "typeLibrary": "__type__ library", + "unnamedType": "Unnamed __type__", + "saveToLibrary": "Save to Library", + "exportToLibrary": "Export nodes to library", + "dialogSaveOverwrite": "A __libraryType__ called __libraryName__ already exists. Overwrite?", + "invalidFilename": "Invalid filename", + "savedNodes": "Saved nodes", + "savedType": "Saved __type__", + "saveFailed": "Save failed: __message__", + + "filename": "Filename", + "folder": "Folder", + "filenamePlaceholder": "file", + "fullFilenamePlaceholder": "a/b/file", + "folderPlaceholder": "a/b", + + "breadcrumb": "Library" + }, + "palette": { + "noInfo": "no information available", + "filter": "filter", + "label": { + "subflows": "subflows", + "input": "input", + "output": "output", + "function": "function", + "social": "social", + "storage": "storage", + "analysis": "analysis", + "advanced": "advanced" + }, + "event": { + "nodeAdded": "Node added to palette:", + "nodeAdded_plural": "Nodes added to palette", + "nodeRemoved": "Node removed from palette:", + "nodeRemoved_plural": "Nodes removed from palette:", + "nodeEnabled": "Node enabled:", + "nodeEnabled_plural": "Nodes enabled:", + "nodeDisabled": "Node disabled:", + "nodeDisabled_plural": "Nodes disabled:" + } + }, + "sidebar": { + "info": { + "title": "info", + "node": "Node", + "type": "Type", + "id": "ID", + "subflow": "Subflow", + "instances": "Instances", + "properties": "Properties", + "blank": "blank", + "arrayItems": "__count__ items" + }, + "config": { + "title": "config" + } + } +} diff --git a/locales/en-US/runtime.json b/locales/en-US/runtime.json new file mode 100644 index 000000000..bbb4053d5 --- /dev/null +++ b/locales/en-US/runtime.json @@ -0,0 +1,123 @@ +{ + "runtime": { + "welcome": "Welcome to Node-RED", + "version": "__component__ version: __version__", + "paths": { + "settings": "Settings file : __path__" + } + }, + + "server": { + "loading": "Loading palette nodes", + "errors": "Failed to register __count__ node type", + "errors_plural": "Failed to register __count__ node types", + "errors-help": "Run with -v for details", + "missing-modules": "Missing node modules:", + "removing-modules": "Removing modules from config", + "added-types": "Added node types:", + "removed-types": "Removed node types:", + "install": { + "invalid": "Invalid module name", + "installing": "Installing module: __name__", + "installed": "Installed module: __name__", + "install-failed": "Install failed", + "install-failed-long": "Installation of module __name__ failed:", + "install-failed-not-found": "$t(install-failed-long) module not found", + + "uninstalling": "Uninstalling module: __name__", + "uninstall-failed": "Uninstall failed", + "uninstall-failed-long": "Uninstall of module __name__ failed:", + "uninstalled": "Uninstalled module: __name__" + }, + "unable-to-listen": "Unable to listen on __listenpath__", + "port-in-use": "Error: port in use", + "uncaught-exception": "Uncaught Exception:", + "admin-ui-disabled": "Admin UI disabled", + "now-running": "Server now running at __listenpath__", + "failed-to-start": "Failed to start server:", + "headless-mode": "Running in headless mode", + "httpadminauth-deprecated": "use of httpAdminAuth is deprecated. Use adminAuth instead" + }, + + "api": { + "flows": { + "error-save": "Error saving flows: __message__" + }, + "library": { + "error-load-entry": "Error loading library entry '__path__': __message__", + "error-save-entry": "Error saving library entry '__path__': __message__", + "error-load-flow": "Error loading flow '__path__': __message__", + "error-save-flow": "Error saving flow '__path__': __message__" + }, + "nodes": { + "enabled": "Enabled node types:", + "disabled": "Disabled node types:", + "error-enable": "Failed to enable node:" + } + }, + + "comms": { + "error": "Communication channel error: __message__", + "error-server": "Communication server error: __message__", + "error-send": "Communication send error: __message__" + }, + + "settings": { + "not-available": "Settings not available", + "property-read-only": "Property '__prop__' is read-only" + }, + + "nodes": { + "credentials": { + "error":"Error loading credentials: __message__", + "not-registered": "Credential type '__type__' is not registered" + }, + "flows": { + "registered-missing": "Missing type registered: __type__", + "error": "Error loading flows: __message__", + "starting-modified-nodes": "Starting modified nodes", + "starting-modified-flows": "Starting modified flows", + "starting-flows": "Starting flows", + "started-modified-nodes": "Started modified nodes", + "started-modified-flows": "Started modified flows", + "started-flows": "Started flows", + "stopping-modified-nodes": "Stopping modified nodes", + "stopping-modified-flows": "Stopping modified flows", + "stopping-flows": "Stopping flows", + "stopped-modified-nodes": "Stopped modified nodes", + "stopped-modified-flows": "Stopped modified flows", + "stopped-flows": "Stopped flows", + "stopped": "Stopped", + "missing-types": "Waiting for missing types to be registered:", + "missing-type-provided": " - __type__ (provided by npm module __module__)", + "missing-type-install-1": "To install any of these missing modules, run:", + "missing-type-install-2": "in the directory:" + }, + "flow": { + "unknown-type": "Unknown type: __type__", + "missing-types": "missing types", + "error-loop": "Message exceeded maximum number of catches" + }, + "index": { + "unrecognised-id": "Unrecognised id: __id__", + "type-in-use": "Type in use: __msg__", + "unrecognised-module": "Unrecognised module: __module__" + }, + "registry": { + "localfilesystem": { + "module-not-found": "Cannot find module '__module__'" + } + } + }, + + "storage": { + "index": { + "forbidden-flow-name": "forbidden flow name" + }, + "localfilesystem": { + "user-dir": "User directory : __path__", + "flows-file": "Flows file : __path__", + "create": "Creating new flow file" + } + } +} diff --git a/nodes/core/analysis/72-sentiment.html b/nodes/core/analysis/72-sentiment.html index c33b873bb..59c889efc 100644 --- a/nodes/core/analysis/72-sentiment.html +++ b/nodes/core/analysis/72-sentiment.html @@ -16,8 +16,8 @@ diff --git a/nodes/core/core/20-inject.html b/nodes/core/core/20-inject.html index 5137e9eda..d7ce8a905 100644 --- a/nodes/core/core/20-inject.html +++ b/nodes/core/core/20-inject.html @@ -16,38 +16,48 @@ \n

        this should be filtered out

        \n\n\n\n\n"); + nodeConfigs.should.equal("\n\n\n\n

        this should be filtered out

        \n\n\n\n\n"); var nodeId = list[0].id; var nodeConfig = typeRegistry.getNodeConfig(nodeId); - nodeConfig.should.equal("\n\n\n\n

        this should be filtered out

        \n"); + nodeConfig.should.equal("\n\n\n\n

        this should be filtered out

        \n"); done(); }).catch(function(e) { done(e); @@ -548,14 +550,18 @@ describe('red/nodes/registry/index', function() { list[1].should.have.property("err"); - eventEmitSpy.callCount.should.equal(2); + eventEmitSpy.callCount.should.equal(3); + + eventEmitSpy.firstCall.args[0].should.be.equal("node-locales-dir"); - eventEmitSpy.firstCall.args[0].should.be.equal("node-icon-dir"); - eventEmitSpy.firstCall.args[1].should.be.equal( + + eventEmitSpy.secondCall.args[0].should.be.equal("node-icon-dir"); + eventEmitSpy.secondCall.args[1].should.be.equal( resourcesDir + "TestNodeModule" + path.sep+ "node_modules" + path.sep + "TestNodeModule" + path.sep + "icons"); - eventEmitSpy.secondCall.args[0].should.be.equal("type-registered"); - eventEmitSpy.secondCall.args[1].should.be.equal("test-node-mod-1"); + + eventEmitSpy.thirdCall.args[0].should.be.equal("type-registered"); + eventEmitSpy.thirdCall.args[1].should.be.equal("test-node-mod-1"); done(); }).catch(function(e) {
        Node
        '+RED._("sidebar.info.node")+'
        Name "+node.name+"
        "+RED._("common.label.name")+" "+node.name+"
        Type "+node.type+"
        ID "+node.id+"
        "+RED._("sidebar.info.type")+" "+node.type+"
        "+RED._("sidebar.info.id")+" "+node.id+"
        Subflow
        '+RED._("sidebar.info.subflow")+'
        name"+subflowNode.name+"
        instances"+userCount+"
        "+RED._("common.label.name")+""+subflowNode.name+"
        "+RED._("sidebar.info.instances")+""+userCount+"
        Properties
        '+RED._("sidebar.info.properties")+'
        '+n+""+val+"