diff --git a/changes/changelog.d/locale.bugfix b/changes/changelog.d/locale.bugfix new file mode 100644 index 0000000000000000000000000000000000000000..5feeaa4c1aa0f6e12fecb8a2ed6df52795ce17f2 --- /dev/null +++ b/changes/changelog.d/locale.bugfix @@ -0,0 +1 @@ +Ensure selected locale is not reset to browser default when refreshing app diff --git a/front/src/App.vue b/front/src/App.vue index ad64cb0b5467523b03f987b6355a9e061ba72212..0895962994978d27e5e518beb1b24f822c6c576d 100644 --- a/front/src/App.vue +++ b/front/src/App.vue @@ -71,7 +71,9 @@ export default { created () { this.openWebsocket() let self = this - this.autodetectLanguage() + if (!this.$store.state.ui.selectedLanguage) { + this.autodetectLanguage() + } setInterval(() => { // used to redraw ago dates every minute self.$store.commit('ui/computeLastDate') diff --git a/front/src/store/index.js b/front/src/store/index.js index 126368e23eaa6759b05bcfde1b9c71bbc5207e5e..d94a0bcc77b61fd09ad8e47f35c40c39ffcd1360 100644 --- a/front/src/store/index.js +++ b/front/src/store/index.js @@ -40,7 +40,7 @@ export default new Vuex.Store({ }), createPersistedState({ key: 'ui', - paths: ['ui.currentLanguage', 'ui.momentLocale', 'ui.theme'] + paths: ['ui.currentLanguage', 'ui.selectedLanguage', 'ui.momentLocale', 'ui.theme'] }), createPersistedState({ key: 'radios', diff --git a/front/src/store/ui.js b/front/src/store/ui.js index b7086346572f3da2ef5708e0fb7ed5100136c7ff..fccbf934864886002303ff11161c096fcc424480 100644 --- a/front/src/store/ui.js +++ b/front/src/store/ui.js @@ -5,6 +5,7 @@ export default { namespaced: true, state: { currentLanguage: 'en_US', + selectedLanguage: false, momentLocale: 'en', lastDate: new Date(), maxMessages: 100, @@ -33,6 +34,7 @@ export default { }, currentLanguage: (state, value) => { state.currentLanguage = value + state.selectedLanguage = true }, momentLocale: (state, value) => { state.momentLocale = value