fix: use alt-i18n-key to avoid overwriting alt tag which makes retranslation impossible
This commit is contained in:
@@ -35,13 +35,11 @@ function translatePageElements() {
|
||||
});
|
||||
// Translate alt texts
|
||||
const translatableAltTexts = document.querySelectorAll(
|
||||
"[alt]",
|
||||
"[alt-i18n-key]",
|
||||
);
|
||||
translatableAltTexts.forEach((el) => {
|
||||
const translation_key = el.getAttribute("alt");
|
||||
console.log(el);
|
||||
const translation_key = el.getAttribute("alt-i18n-key");
|
||||
el.setAttribute("alt", i18next.t(translation_key));
|
||||
console.log(i18next.t(translation_key));
|
||||
});
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user