From 50017c28da15a7d06136a9e6b1747c0cd20b5ee7 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 27 Jan 2017 22:36:00 +0000 Subject: [PATCH] Allow port labels be i18n identifiers --- editor/js/nodes.js | 7 ++++++- editor/js/ui/view.js | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/editor/js/nodes.js b/editor/js/nodes.js index aa2e93365..1b901f069 100644 --- a/editor/js/nodes.js +++ b/editor/js/nodes.js @@ -136,10 +136,15 @@ RED.nodes = (function() { } def["_"] = function() { var args = Array.prototype.slice.call(arguments, 0); + var original = args[0]; if (args[0].indexOf(":") === -1) { args[0] = ns+":"+args[0]; } - return RED._.apply(null,args); + var result = RED._.apply(null,args); + if (result === args[0]) { + result = original; + } + return result; } // TODO: too tightly coupled into palette UI diff --git a/editor/js/ui/view.js b/editor/js/ui/view.js index 3786a8200..a5b4a21f2 100644 --- a/editor/js/ui/view.js +++ b/editor/js/ui/view.js @@ -1500,6 +1500,9 @@ RED.view = (function() { } else if ($.isArray(portLabels)) { result = portLabels[portIndex]; } + if (result) { + result = node._(result); + } return result; } function portMouseOver(port,d,portType,portIndex) {