From 5b73aefa87066364bcb83307b4d598cf034d9dd4 Mon Sep 17 00:00:00 2001 From: Marjolaine Le Bon <marjolaine@nantes.happy-dev.fr> Date: Thu, 24 Feb 2022 21:07:52 +0100 Subject: [PATCH 1/2] Update intl.js --- src/scripts/intl.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/scripts/intl.js b/src/scripts/intl.js index ee503976..c3f5d469 100644 --- a/src/scripts/intl.js +++ b/src/scripts/intl.js @@ -113,6 +113,16 @@ class JsI18n { } } } + if (attr.startsWith('enum-')) { + let enum = node.querySelector('[enum="' + attr.replace("enum-", "") + '"]'); + if (enum != null) { + this.translateNodeContent(enum.attributes['enum'], k); + let input = node.querySelector('[name="' + attr.replace("enum-", "") + '"] > input'); + if (input != null) { + this.translateNodeContent(input.attributes['enum'], k); + } + } + } this.translateNodeContent(node.attributes[attr], k); } } @@ -285,4 +295,4 @@ document.addEventListener("DOMContentLoaded", () => { clearTimeout(timer); timer = setTimeout(() => window.orbit.intl.processNode(document.querySelector('body')), 500); }); -}); \ No newline at end of file +}); -- GitLab From 3241dd17a0e74b9dd1b43111eea04a067b86f8f2 Mon Sep 17 00:00:00 2001 From: Marjolaine Le Bon <marjolaine@nantes.happy-dev.fr> Date: Thu, 24 Feb 2022 21:13:16 +0100 Subject: [PATCH 2/2] Update intl.js --- src/scripts/intl.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/scripts/intl.js b/src/scripts/intl.js index c3f5d469..22bf76eb 100644 --- a/src/scripts/intl.js +++ b/src/scripts/intl.js @@ -114,9 +114,9 @@ class JsI18n { } } if (attr.startsWith('enum-')) { - let enum = node.querySelector('[enum="' + attr.replace("enum-", "") + '"]'); - if (enum != null) { - this.translateNodeContent(enum.attributes['enum'], k); + let enumAttr = node.querySelector('[enum="' + attr.replace("enum-", "") + '"]'); + if (enumAttr != null) { + this.translateNodeContent(enumAttr.attributes['enum'], k); let input = node.querySelector('[name="' + attr.replace("enum-", "") + '"] > input'); if (input != null) { this.translateNodeContent(input.attributes['enum'], k); -- GitLab