no message
Former-commit-id: a4e79ebf7a44c60ffeb61db861fb00b9d721c677 [formerly a4e79ebf7a44c60ffeb61db861fb00b9d721c677 [formerly a4e79ebf7a44c60ffeb61db861fb00b9d721c677 [formerly a4e79ebf7a44c60ffeb61db861fb00b9d721c677 [formerly 63d01613b6bcb1a85ee6d314d1a12ac7989f4760 [formerly bd4a663ccf9c9f8ec0d97c2c15635fd531e27b82]]]]] Former-commit-id: 280b9c2436ba07693c840c681202b043d88c89d1 Former-commit-id: b476179e011a02f4cf1ff45b251894e49c451851 Former-commit-id: a8aafd8962ac6fe3784a13556d70ea59752acd4d [formerly f175280128b21172b0b167a7d7846a0e2faf0157] Former-commit-id: 658ff2f89f566951c2745470a237fb56f58d854b Former-commit-id: bb8e47613fe4eae42e2af74db7dd5be81685a036 Former-commit-id: 77aaccc5290d6c86d8817dd5a36808bcb09fc14d Former-commit-id: 06ca8f89c9237debb4fd026980e45dee0b31b8f6 Former-commit-id: 9152927efc1c98101f0021bc495a8fba24b36be4
This commit is contained in:
15
src/App.vue
15
src/App.vue
@@ -5,8 +5,21 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import util from '@/libs/util'
|
||||||
export default {
|
export default {
|
||||||
name: 'app'
|
name: 'app',
|
||||||
|
watch: {
|
||||||
|
'$i18n.locale': 'i18nHandle'
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
this.i18nHandle(this.$i18n.locale)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
i18nHandle (val, oldVal) {
|
||||||
|
util.cookies.set('lang', val)
|
||||||
|
document.querySelector('html').setAttribute('lang', val)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import VueI18n from 'vue-i18n'
|
import VueI18n from 'vue-i18n'
|
||||||
|
import util from '@/libs/util'
|
||||||
|
|
||||||
Vue.use(VueI18n)
|
Vue.use(VueI18n)
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ Vue.prototype.$languages = Object.keys(messages).map(langlage => ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
export default new VueI18n({
|
export default new VueI18n({
|
||||||
locale: process.env.VUE_APP_I18N_LOCALE || 'en',
|
locale: util.cookies.get('lang') || process.env.VUE_APP_I18N_LOCALE,
|
||||||
fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en',
|
fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en',
|
||||||
messages
|
messages
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user