Update web.app.localizer.js

This commit is contained in:
Saifeddine ALOUI 2024-12-13 09:34:10 +01:00 committed by GitHub
parent 23925f1032
commit 7cdfc1f018
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
}
});