Fix mobile support
This commit is contained in:
parent
173f104f58
commit
d56a41f063
2 changed files with 8 additions and 0 deletions
|
@ -75,12 +75,20 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
|
||||||
// Language support
|
// Language support
|
||||||
async function getLanguageData(lang){
|
async function getLanguageData(lang){
|
||||||
|
if (!lang || lang === ""){
|
||||||
|
lang = "en";
|
||||||
|
}
|
||||||
|
|
||||||
const response = await fetch(`languages/${lang}.json`);
|
const response = await fetch(`languages/${lang}.json`);
|
||||||
return response.json();
|
return response.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", async () => {
|
document.addEventListener("DOMContentLoaded", async () => {
|
||||||
const userLang = navigator.language || navigator.userLanguage;
|
const userLang = navigator.language || navigator.userLanguage;
|
||||||
|
if (userLang === "de-DE"){
|
||||||
|
userLang = "de";
|
||||||
|
}
|
||||||
|
|
||||||
const langData = await getLanguageData(userLang);
|
const langData = await getLanguageData(userLang);
|
||||||
|
|
||||||
document.querySelectorAll("[data-i18n]").forEach((element) => {
|
document.querySelectorAll("[data-i18n]").forEach((element) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue