From 7cdfc1f0182815fbda5aaeb23b413fb51146fb57 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Fri, 13 Dec 2024 09:34:10 +0100 Subject: [PATCH] Update web.app.localizer.js --- endpoints/libraries/web.app.localizer.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/endpoints/libraries/web.app.localizer.js b/endpoints/libraries/web.app.localizer.js index 9f5735ff..91a5f36c 100644 --- a/endpoints/libraries/web.app.localizer.js +++ b/endpoints/libraries/web.app.localizer.js @@ -58,9 +58,14 @@ class WebAppLocalizer { const key = element.getAttribute('data-translate'); const useHTML = element.hasAttribute('data-translate-html'); - if (useHTML) { + if (key.includes('placeholder')) { + // If the key contains "placeholder", set the translation as the placeholder attribute + element.setAttribute('placeholder', this.translate(key)); + } else if (useHTML) { + // If data-translate-html is present, set the translation as innerHTML element.innerHTML = this.translate(key); } else { + // Otherwise, set the translation as textContent element.textContent = this.translate(key); } });