Expose i18n in editor

This commit is contained in:
Nick O'Leary
2015-05-06 22:14:00 +01:00
parent 008bc98070
commit a7900940da
12 changed files with 133 additions and 38 deletions

View File

@@ -574,13 +574,21 @@ 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) {
$(this).attr("data-i18n",ns+":"+current);
}
});
$('<input type="text" style="display: none;" />').appendTo("#dialog-form");
prepareEditDialog(node,node._def,"node-input");
$("#dialog").i18n();
$( "#dialog" ).dialog("option","title","Edit "+type+" node").dialog( "open" );
}
@@ -603,6 +611,21 @@ RED.editor = (function() {
}
$("#dialog-config-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-config-form").find('[data-i18n]').each(function() {
var current = $(this).attr("data-i18n");
if (current.indexOf(":") === -1) {
$(this).attr("data-i18n",ns+":"+current);
}
});
prepareEditDialog(configNode,node_def,"node-config-input");
var buttons = $( "#node-config-dialog" ).dialog("option","buttons");
@@ -652,6 +675,8 @@ RED.editor = (function() {
}
$( "#node-config-dialog" ).dialog("option","buttons",buttons);
$("#node-config-dialog").i18n();
$( "#node-config-dialog" )
.dialog("option","node-adding",adding)
.dialog("option","node-property",name)