From 4943bde3d4bbf6b952999d7bee73233a7e03b916 Mon Sep 17 00:00:00 2001 From: fellinga Date: Sun, 27 Dec 2020 12:59:12 +0100 Subject: [PATCH 1/2] add optional lang select --- packages/node_modules/@node-red/util/index.js | 2 +- packages/node_modules/@node-red/util/lib/i18n.js | 2 +- packages/node_modules/node-red/settings.js | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/util/index.js b/packages/node_modules/@node-red/util/index.js index 29e1a480c..aeb566540 100644 --- a/packages/node_modules/@node-red/util/index.js +++ b/packages/node_modules/@node-red/util/index.js @@ -33,7 +33,7 @@ module.exports = { */ init: function(settings) { log.init(settings); - i18n.init(); + i18n.init(settings); }, /** diff --git a/packages/node_modules/@node-red/util/lib/i18n.js b/packages/node_modules/@node-red/util/lib/i18n.js index cce2e8149..8ba1d08c5 100644 --- a/packages/node_modules/@node-red/util/lib/i18n.js +++ b/packages/node_modules/@node-red/util/lib/i18n.js @@ -160,7 +160,7 @@ function init() { suffix: '__' } }; - var lang = getCurrentLocale(); + var lang = settings.lang || getCurrentLocale(); if (lang) { opt.lng = lang; } diff --git a/packages/node_modules/node-red/settings.js b/packages/node_modules/node-red/settings.js index fd07630f2..deedd726d 100644 --- a/packages/node_modules/node-red/settings.js +++ b/packages/node_modules/node-red/settings.js @@ -248,6 +248,8 @@ module.exports = { // their values. Setting this to true will cause the keys to be listed. exportGlobalContextKeys: false, + // Uncomment the following to run node-red in your preferred language: + // lang: "de", // Context Storage // The following property can be used to enable context storage. The configuration From b36e7e172eecf66616e7b230943523792f83fd7c Mon Sep 17 00:00:00 2001 From: fellinga Date: Sun, 27 Dec 2020 14:44:32 +0100 Subject: [PATCH 2/2] add settings to init --- packages/node_modules/@node-red/util/lib/i18n.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/util/lib/i18n.js b/packages/node_modules/@node-red/util/lib/i18n.js index 8ba1d08c5..e9dbedace 100644 --- a/packages/node_modules/@node-red/util/lib/i18n.js +++ b/packages/node_modules/@node-red/util/lib/i18n.js @@ -142,7 +142,7 @@ function getCurrentLocale() { return undefined; } -function init() { +function init(settings) { if (!initPromise) { // Keep this as a 'when' promise as top-level red.js uses 'otherwise' // and embedded users of NR may have copied that.