Repository navigation
Conversation
The language setting defaulted to 'en', and App.svelte applies any truthy value over the locale picked from the browser, so a Spanish or Swedish browser still got English, sign-in page included. The setting now starts empty, so the browser's language stands until one is picked, and Settings > Regional & Units shows the language in use while it's empty.
1 task done
Contributor
|
Thanks! This is on dev now (fd11848), done the same way as in NutriTrace. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pickInitialLocale()starts the app in the browser's language, andmain.jssays the saved setting takes over once it loads. But thelanguagesetting defaults to'en', and$: if ($language) locale.set($language)inApp.sveltetreats that default as a choice, so the browser's language is replaced with English straight away. A Spanish or Swedish browser gets English everywhere, the sign-in page included, until the person finds Settings > Regional & Units and picks their language.This makes the setting start empty, so nothing replaces the browser's language until someone picks one. Settings > Regional & Units shows
$language || $locale, so the picker shows the language in use rather than a blank select while nothing is saved. A language someone picks is saved and wins over the browser's, as before. Nothing else reads the setting: the server, the Android app and the watch don't use it.What I ran
npm run i18n:checkandnpm testonnode:24-bookworm: 1162 tests, all passing.navigator.languageises-ES), the sign-in page is in Spanish. Ondevit's in English.language: "en", and after a reload the app is in English while the browser stays Spanish.There's no new test: the change is a store default and one binding, so I checked it in a browser instead. NutriTrace's
devhas the same default and the same line inApp.svelte.Both this and #90 add a line under Fixed in
CHANGELOG.md, so whichever merges second needs a one-line rebase.