import { createApp } from 'vue';
import App from './App.vue';
import store from './store';
import router from './router';
import './assets/styles.scss';
import i18n from './i18n';
import { createVuetify } from 'vuetify';
import * as components from 'vuetify/components';
import * as directives from 'vuetify/directives';

function getBrowserLanguage() {
    const browserLanguage = navigator.language || navigator.languages[0];
    if (browserLanguage.startsWith('de')) {
        return 'de';
    } else {
        return 'en';
    }
}

const vuetify = createVuetify({
    components,
    directives,
});

store.dispatch('setLanguage', getBrowserLanguage());

const app = createApp(App);

app.use(store);
app.use(router);
app.use(i18n);
app.use(vuetify);

app.mount('#app');
