-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
chore: cleanup language settings and language selector #337
Conversation
@@ -9,7 +9,6 @@ export const useAppStore = defineStore('app', { | |||
last_product_mode_used: 'barcode', | |||
last_currency_used: 'EUR', // TODO: init with user locale ? | |||
recent_locations: [], | |||
language: localStorage.getItem('user-locale') || import.meta.env.VITE_DEFAULT_LOCALE, // 'en' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should keep the user.language
key here + a default value (null or VITE_DEFAUL_LOCALE) + indicate it will be a code (ex : 'en')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should indeed be here. I messed up when merging the changes from master in 2nd commit and deleted the line.
@@ -113,12 +113,12 @@ export default { | |||
methods: { | |||
initUserSettingsForm() { | |||
this.userSettingsForm.currency = this.appStore.user.last_currency_used | |||
this.userSettingsForm.selectedLanguage = this.languageList.find(lang => lang.code === localeManager.guessDefaultLocale()) || this.languageList.find(lang => lang.code === 'en') | |||
this.userSettingsForm.selectedLanguage = this.languageList.find(lang => lang.code === localeManager.guessDefaultLocale()).code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it feels strange that the guessDefaultLocale
happens in the settings form (vs on app startup).
here it means the new user arrived on the app, the app will show up by default as 'en', right ? even if the user has a 'French' browser ? And after logging in, and going to its settings page, then the form field language will show 'French' 🤔
Or I'm missing something ? 😅
What