view client/src/main.js @ 160:061209505028

feat: Login and logout with session restoration implemented Login information stored in local storage for restoration after browser restart. If a non expired session is found, it is restored before entering the main area. Username and logout are located in the lower sidebar.
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 04 Jul 2018 17:21:10 +0200
parents 3d9341f6da4e
children 22deb76dff2c
line wrap: on
line source

import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import GetTextPlugin from "vue-gettext";
import translations from "./translations.json";
import locale2 from "locale2";
import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
import "../node_modules/font-awesome/css/font-awesome.min.css";
import "../node_modules/ol/ol.css";

let browserLanguage = locale2;

// planned also SK, HU, HR, RS, BiH, BG, RO, UA
const supportedLanguages = {
  en_GB: "British English",
  de_AT: "Deutsch"
};

if (browserLanguage === "de-DE") {
  browserLanguage = "de-AT"; // map german to austrian variant for now
}

const language = browserLanguage.replace("-", "_");
const isLanguageAvailable = supportedLanguages[language];
let defaultLanguage = isLanguageAvailable ? language : "en_GB";

Vue.use(GetTextPlugin, {
  translations: translations,
  availableLanguages: supportedLanguages,
  defaultLanguage: defaultLanguage
});

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");