From f77073410e8ac823c5fb29c9b9722a7cce07979a Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 30 Jun 2024 14:52:18 -0700 Subject: [PATCH] refac --- backend/main.py | 1 - src/routes/+layout.svelte | 15 +++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/backend/main.py b/backend/main.py index c0406301e..df3f884b3 100644 --- a/backend/main.py +++ b/backend/main.py @@ -99,7 +99,6 @@ from config import ( CHANGELOG, FRONTEND_BUILD_DIR, UPLOAD_DIR, - CACHE_DIR, STATIC_DIR, DEFAULT_LOCALE, diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index bd5d5a904..68c1e1596 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -92,16 +92,15 @@ // Initialize i18n even if we didn't get a backend config, // so `/error` can show something that's not `undefined`. - const languages = await getLanguages(); - const browserLanguages = navigator.languages - ? navigator.languages - : [navigator.language || navigator.userLanguage]; - const lang = backendConfig.default_locale - ? backendConfig.default_locale - : bestMatchingLanguage(languages, browserLanguages, 'en-US'); - initI18n(); if (!localStorage.locale) { + const languages = await getLanguages(); + const browserLanguages = navigator.languages + ? navigator.languages + : [navigator.language || navigator.userLanguage]; + const lang = backendConfig.default_locale + ? backendConfig.default_locale + : bestMatchingLanguage(languages, browserLanguages, 'en-US'); $i18n.changeLanguage(lang); }