Debian Codegraph @

internal/ui/assets/i18n.js

raw
1 (async () => {
2 const response = await fetch(`../assets/i18n/${navigator.language.split('-')[0]}.json`);
3 if (!response.ok) return
4
5 const json = await response.json();
6
7 document.querySelectorAll("[data-i18n]").forEach(el => {
8 if (el.innerText in json) {
9 el.innerText = json[el.innerText];
10 }
11 });
12 })();