Skip to content

Commit

Permalink
use translated title image
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ol committed Oct 23, 2024
1 parent 192ca5b commit 4e10c69
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Binary file removed assets/title.png
Binary file not shown.
9 changes: 8 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@
</div>

<div class="page page-flip visible" id="page-start">
<h1><img src="assets/title.png" data-i18n-alt="title" alt="Stories of online harassment" /></h1>
<h1>
<img
data-i18n-src="assets/title/"
data-i18n-alt="title"
src="assets/title/en.png"
alt="Stories of online harassment"
/>
</h1>
<div>
<p data-i18n="start-intro">To explore the poster, give access to your phone camera and calibrate it.</p>
<button data-i18n="start-button" id="button-start" disabled>start</button>
Expand Down
5 changes: 5 additions & 0 deletions src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const update = (lang) => {
for (const el of Array.from(document.querySelectorAll('[data-i18n-alt]'))) {
el.alt = getString(lang, el.dataset['i18nAlt']);
}

for (const el of Array.from(document.querySelectorAll('[data-i18n-src]'))) {
el.src = el.dataset['i18nSrc'] + lang + '.png';
el.onerror = () => el.src = el.dataset['i18nSrc'] + 'en.png';
}
};

module.exports = (select) => {
Expand Down

0 comments on commit 4e10c69

Please sign in to comment.