2019-10-13 13:56:24 +02:00
|
|
|
import Vue from 'vue';
|
|
|
|
import VueI18n from 'vue-i18n';
|
|
|
|
import messages from '@/i18n/index';
|
|
|
|
|
2020-02-03 14:08:40 +01:00
|
|
|
const language = ((window.navigator as any).userLanguage || window.navigator.language).replace(/-/, '_');
|
|
|
|
const locale = messages.hasOwnProperty(language) ? language : language.split('-')[0];
|
2019-10-13 13:56:24 +02:00
|
|
|
|
|
|
|
Vue.use(VueI18n);
|
|
|
|
|
|
|
|
export const i18n = new VueI18n({
|
2020-02-03 14:08:40 +01:00
|
|
|
locale, // set locale
|
2019-10-13 13:56:24 +02:00
|
|
|
messages, // set locale messages
|
|
|
|
fallbackLocale: 'en_US',
|
|
|
|
});
|