2019-03-11 19:21:10 +01:00
|
|
|
// src/boot/vue-i18n.js
|
|
|
|
|
import VueI18n from 'vue-i18n'
|
|
|
|
|
import messages from '../statics/i18n'
|
|
|
|
|
import { tools } from '../store/Modules/tools'
|
|
|
|
|
|
2019-04-29 23:47:42 +02:00
|
|
|
|
2019-03-11 19:21:10 +01:00
|
|
|
export default ({ app, store, Vue }) => {
|
|
|
|
|
Vue.use(VueI18n)
|
|
|
|
|
// Vue.config.lang = process.env.LANG_DEFAULT;
|
|
|
|
|
|
|
|
|
|
let mylang = tools.getItemLS(tools.localStorage.lang)
|
|
|
|
|
|
|
|
|
|
if ((navigator) && (mylang === '')) {
|
|
|
|
|
mylang = navigator.language
|
|
|
|
|
// console.log(`LANG NAVIGATOR ${mylang}`)
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-14 21:09:41 +01:00
|
|
|
mylang = tools.checkLangPassed(mylang)
|
2019-03-11 19:21:10 +01:00
|
|
|
|
|
|
|
|
Vue.config.lang = mylang
|
|
|
|
|
|
|
|
|
|
// Set i18n instance on app
|
|
|
|
|
app.i18n = new VueI18n({
|
|
|
|
|
fallbackLocale: mylang,
|
|
|
|
|
locale: mylang,
|
|
|
|
|
messages
|
|
|
|
|
})
|
|
|
|
|
}
|