2020-02-18 08:57:00 +01:00
|
|
|
import Vue from "vue";
|
|
|
|
import VueI18n from "vue-i18n";
|
|
|
|
import messages from "../i18n/index";
|
2019-10-13 13:56:24 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
let language = document.documentElement.getAttribute("lang") as string;
|
|
|
|
language = language || ((window.navigator as any).userLanguage || window.navigator.language).replace(/-/, "_");
|
|
|
|
const locale = language && 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
|
2020-02-18 08:57:00 +01:00
|
|
|
fallbackLocale: "en_US",
|
2019-10-13 13:56:24 +02:00
|
|
|
});
|