diff options
author | Dixsie Wolmers <dixsie@ibm.com> | 2020-02-26 22:22:12 +0300 |
---|---|---|
committer | Dixsie Wolmers <dixsie@ibm.com> | 2020-03-06 19:10:31 +0300 |
commit | c85395f21d7e27ba16f4b9005e7f2f2452cdd7f8 (patch) | |
tree | a93812a8cc60404120b8ae3d913afed91f1181f7 /src/views | |
parent | 9fc3f90ac221bbe6b6d5b795e7fbaac68b17b7b6 (diff) | |
download | webui-vue-c85395f21d7e27ba16f4b9005e7f2f2452cdd7f8.tar.xz |
Persist language settings using local storage
When user logs in, language setting will be stored in local storage.
Once stored, user does not have to re-select preferred language, but can
still update language settings on the login page.
Before a language is saved to local storage the locale = null
Renamed 'en.json' to 'en-US' because the vue i18n plugin defaults to
'en-US' when a language is not selected or null.
https://github.com/kazupon/vue-i18n/blob/v8.x/src/index.js#L67
Signed-off-by: Dixsie Wolmers <dixsie@ibm.com>
Change-Id: I577db3c4578eab30fbfae997dad0ece456fdf231
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/Login/Login.vue | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/views/Login/Login.vue b/src/views/Login/Login.vue index 10ebb930..fd6e711c 100644 --- a/src/views/Login/Login.vue +++ b/src/views/Login/Login.vue @@ -82,6 +82,7 @@ <script> import { required } from 'vuelidate/lib/validators'; import VuelidateMixin from '../../components/Mixins/VuelidateMixin.js'; +import i18n from '../../i18n'; export default { name: 'Login', @@ -94,9 +95,8 @@ export default { }, disableSubmitButton: false, languages: [ - { value: null, text: this.$t('global.form.selectAnOption') }, { - value: 'en', + value: 'en-US', text: this.$t('pageLogin.form.english') }, { @@ -131,6 +131,7 @@ export default { this.$store .dispatch('authentication/login', [username, password]) .then(() => this.$router.push('/')) + .then(localStorage.setItem('storedLanguage', i18n.locale)) .catch(error => console.log(error)) .finally(() => (this.disableSubmitButton = false)); } |