WIP: feat(webui): translations support #903

Closed
AMelonInsideLemon wants to merge 5 commits from AMelonInsideLemon:webui-lang into main
Showing only changes of commit 5ca8af0954 - Show all commits

View File

@ -120,6 +120,8 @@ async function setActiveLanguage(lang) {
document.querySelector("[data-lang=" + lang + "]").classList.add("active");
const response = await fetch(`/webui/translations/${lang}.json`);
const translations = await response.json();
const fallbackResponse = await fetch(`/webui/translations/en.json`);
const fallbackTranslations = await fallbackResponse.json();
i18next.init(
{
@ -128,6 +130,9 @@ async function setActiveLanguage(lang) {
resources: {
[lang]: {
translation: translations
},
en: {
translation: fallbackTranslations
}
}
},