fix: use alt-i18n-key to avoid overwriting alt tag which makes retranslation impossible
This commit is contained in:
parent
3831b81ec2
commit
b7f2a3ed67
@ -35,7 +35,7 @@
|
||||
<label for="SavicSuiteRoyaleXL">
|
||||
<input type="checkbox" id="SavicSuiteRoyaleXL"/>
|
||||
<div class="card-photo">
|
||||
<img alt="alt-savic-xl" src="assets/img/savic-xl.jpeg">
|
||||
<img alt-i18n-key="alt-savic-xl" src="assets/img/savic-xl.jpeg">
|
||||
</div>
|
||||
<div class="info-container">
|
||||
<h4><b>Savic Suite Royale XL</b></h4>
|
||||
@ -48,7 +48,7 @@
|
||||
<input type="checkbox" id="SavicSuiteRoyale95Double"/>
|
||||
<div class="card-photo">
|
||||
<div>
|
||||
<img alt="alt-savic-95-double" src="assets/img/savic-95-double.jpg">
|
||||
<img alt-i18n-key="alt-savic-95-double" src="assets/img/savic-95-double.jpg">
|
||||
</div>
|
||||
<div class="info-container">
|
||||
<h4><b>Savic Suite Royale 95 Double</b></h4>
|
||||
@ -61,7 +61,7 @@
|
||||
<label for="TiakiKleintierkäfigEtagere">
|
||||
<input type="checkbox" id="TiakiKleintierkäfigEtagere"/>
|
||||
<div class="card-photo">
|
||||
<img alt="alt-tiaki" src="assets/img/tiaki.jpeg">
|
||||
<img alt-i18n-key="alt-tiaki" src="assets/img/tiaki.jpeg">
|
||||
</div>
|
||||
<div class="info-container">
|
||||
<h4><b>TIAKI Kleintierkäfig Étagère</b></h4>
|
||||
|
@ -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));
|
||||
});
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user