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

chore: cleanup language settings and language selector #337

Merged
merged 3 commits into from
Mar 5, 2024

Conversation

dq18
Copy link
Collaborator

@dq18 dq18 commented Feb 15, 2024

@@ -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'
Copy link
Member

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')

Copy link
Collaborator Author

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
Copy link
Member

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 ? 😅

@dq18 dq18 merged commit 396c808 into master Mar 5, 2024
2 checks passed
@dq18 dq18 deleted the locale-setup-cleanup branch March 5, 2024 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants