Fixed uneeded error when activating en_US locale

This commit is contained in:
Eliot Berriot 2020-02-25 15:50:00 +01:00
parent 7819c60164
commit 80f0cc12e9
No known key found for this signature in database
GPG Key ID: 6B501DFD73514E14
1 changed files with 5 additions and 3 deletions

View File

@ -335,6 +335,11 @@ export default {
immediate: true,
handler(newValue) {
let self = this
if (newValue === 'en_US') {
self.$language.current = 'noop'
self.$language.current = newValue
return self.$store.commit('ui/momentLocale', 'en')
}
import(/* webpackChunkName: "locale-[request]" */ `./translations/${newValue}.json`).then((response) =>{
Vue.$translations[newValue] = response.default[newValue]
}).finally(() => {
@ -343,9 +348,6 @@ export default {
self.$language.current = 'noop'
self.$language.current = newValue
})
if (newValue === 'en_US') {
return self.$store.commit('ui/momentLocale', 'en')
}
let momentLocale = newValue.replace('_', '-').toLowerCase()
import(/* webpackChunkName: "moment-locale-[request]" */ `moment/locale/${momentLocale}.js`).then(() => {
self.$store.commit('ui/momentLocale', momentLocale)