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

Merge pull request #2334 from kazuhitoyokoi/master-fixsubflowlang2

Fix language handling in subflow node
This commit is contained in:
Nick O'Leary 2019-10-23 21:36:57 +01:00 committed by GitHub
commit f9b147af42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -802,16 +802,16 @@ RED.subflow = (function() {
} }
$("<option/>", opt).text(item.text).appendTo(locales); $("<option/>", opt).text(item.text).appendTo(locales);
}); });
currentLocale = RED.i18n.lang(); var locale = RED.i18n.lang();
locales.val(currentLocale); locales.val(locale);
locales.on("change", function() { locales.on("change", function() {
var locale = $(this).val(); currentLocale = $(this).val();
var items = $("#node-input-env-container").editableList("items"); var items = $("#node-input-env-container").editableList("items");
items.each(function (i, item) { items.each(function (i, item) {
var entry = $(this).data('data'); var entry = $(this).data('data');
var labelField = entry.ui.labelField; var labelField = entry.ui.labelField;
labelField.val(lookupLabel(entry.ui.label, "", locale)); labelField.val(lookupLabel(entry.ui.label, "", currentLocale));
if (labelField.timeout) { if (labelField.timeout) {
clearTimeout(labelField.timeout); clearTimeout(labelField.timeout);
delete labelField.timeout; delete labelField.timeout;
@ -1371,7 +1371,8 @@ RED.subflow = (function() {
} }
var labels = ui.label || {}; var labels = ui.label || {};
var labelText = lookupLabel(labels, labels["en-US"]||tenv.name, currentLocale); var locale = RED.i18n.lang();
var labelText = lookupLabel(labels, labels["en-US"]||tenv.name, locale);
var label = $('<label>').appendTo(row); var label = $('<label>').appendTo(row);
var labelContainer = $('<span></span>').appendTo(label); var labelContainer = $('<span></span>').appendTo(label);
if (ui.icon) { if (ui.icon) {
@ -1423,7 +1424,7 @@ RED.subflow = (function() {
input = $('<select>').css('width','70%').appendTo(row); input = $('<select>').css('width','70%').appendTo(row);
if (ui.opts.opts) { if (ui.opts.opts) {
ui.opts.opts.forEach(function(o) { ui.opts.opts.forEach(function(o) {
$('<option>').val(o.v).text(lookupLabel(o.l, o.l['en-US']||o.v, currentLocale)).appendTo(input); $('<option>').val(o.v).text(lookupLabel(o.l, o.l['en-US']||o.v, locale)).appendTo(input);
}) })
} }
input.val(val.value); input.val(val.value);