1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-21 23:37:55 +00:00
bramw_baserow/web-frontend/modules/core/mixins/languageDetection.js
2022-08-27 12:30:07 +00:00

19 lines
447 B
JavaScript

/**
* This mixin forces language detection based on the browser settings instead of the
* language stored in the nuxt-i18n cookie.
*/
export default {
data() {
return {
originalLanguageBeforeDetect: null,
}
},
created() {
this.originalLanguageBeforeDetect = this.$i18n.locale
this.$i18n.locale = this.$i18n.getBrowserLocale()
},
beforeDestroy() {
this.$i18n.locale = this.originalLanguageBeforeDetect
},
}