Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: default locale #3555

Merged
merged 2 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refac
  • Loading branch information
tjbck committed Jun 30, 2024
commit f77073410e8ac823c5fb29c9b9722a7cce07979a
1 change: 0 additions & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 99,6 @@
CHANGELOG,
FRONTEND_BUILD_DIR,
UPLOAD_DIR,

CACHE_DIR,
STATIC_DIR,
DEFAULT_LOCALE,
Expand Down
15 changes: 7 additions & 8 deletions src/routes/ layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Loading