Update view language if system language is changed and the user has no profile language set

This commit is contained in:
Johannes Zellner
2025-09-17 12:06:50 +02:00
parent 753092db30
commit 9ba4ac9956
4 changed files with 9 additions and 4 deletions
+4 -2
View File
@@ -51,8 +51,10 @@ async function main() {
return i18n;
}
async function setLanguage(lang) {
window.localStorage.NG_TRANSLATE_LANG_KEY = lang;
async function setLanguage(lang, profile = false) {
// only change if we set the language also for the profile or the user has no profile language set
if (profile) window.localStorage.NG_TRANSLATE_LANG_KEY = lang;
else if (window.localStorage.NG_TRANSLATE_LANG_KEY) return;
try {
const result = await fetcher.get(`${API_ORIGIN}/translation/${lang}.json`);