2024-08-01 21:26:01 +00:00
|
|
|
import './assets/main.css'
|
|
|
|
import './assets/prism.css'
|
|
|
|
|
2024-09-15 15:25:50 +00:00
|
|
|
import { createApp, defineComponent, reactive } from 'vue'
|
2024-09-21 23:00:28 +00:00
|
|
|
import { createI18n } from 'vue-i18n'
|
2024-08-01 21:26:01 +00:00
|
|
|
import App from './App.vue'
|
|
|
|
import router from './router'
|
|
|
|
|
|
|
|
import mitt from 'mitt';
|
2024-09-23 09:51:39 +00:00
|
|
|
import { GetUser, GetUserSetting, LogoutUser } from './services/User'
|
2024-08-01 21:26:01 +00:00
|
|
|
const emitter = mitt();
|
|
|
|
|
2024-09-15 15:25:50 +00:00
|
|
|
const app = createApp(App);
|
2024-08-05 14:55:37 +00:00
|
|
|
app.config.globalProperties.emitter = emitter
|
2024-08-02 16:54:14 +00:00
|
|
|
app.config.globalProperties.rollWindows = {
|
|
|
|
login: reactive([]),
|
|
|
|
register: reactive([]),
|
|
|
|
test: reactive([]),
|
|
|
|
main_menu: reactive([]),
|
|
|
|
edit_profile: reactive([]),
|
|
|
|
};
|
2024-08-01 21:26:01 +00:00
|
|
|
|
2024-09-22 15:51:04 +00:00
|
|
|
|
|
|
|
console.clear();
|
|
|
|
console.log("%cLoaded!!!", "color: #22ff22; font-size: 24px");
|
|
|
|
|
|
|
|
// Determinem el locale
|
2024-09-23 09:51:39 +00:00
|
|
|
let locale = 'en-US';
|
|
|
|
|
|
|
|
let supportedLocales = ['en-US', 'es-ES', 'ca'];
|
|
|
|
let navLocale = window.navigator.language;
|
|
|
|
console.log(navLocale);
|
|
|
|
|
|
|
|
if(supportedLocales.includes(navLocale)) locale = navLocale;
|
|
|
|
|
|
|
|
try {
|
|
|
|
if(GetUser()) locale = await GetUserSetting('lang');
|
|
|
|
} catch(ex) {
|
|
|
|
LogoutUser();
|
|
|
|
}
|
2024-09-22 15:51:04 +00:00
|
|
|
console.log(locale);
|
|
|
|
|
2024-09-21 23:00:28 +00:00
|
|
|
const i18n = createI18n({
|
|
|
|
legacy: false,
|
2024-09-22 15:51:04 +00:00
|
|
|
locale,
|
2024-09-23 09:51:39 +00:00
|
|
|
fallbackLocale: 'en-US',
|
2024-09-21 23:00:28 +00:00
|
|
|
messages: {
|
2024-09-23 09:51:39 +00:00
|
|
|
'en-US': (await import(`./locale/en-US.json`)).default,
|
|
|
|
'es-ES': (await import(`./locale/es-ES.json`)).default,
|
|
|
|
'ca': (await import(`./locale/ca.json`)).default,
|
2024-09-21 23:00:28 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-08-01 21:26:01 +00:00
|
|
|
app.use(router)
|
2024-09-21 23:00:28 +00:00
|
|
|
app.use(i18n);
|
2024-08-01 21:26:01 +00:00
|
|
|
|
2024-08-08 23:29:08 +00:00
|
|
|
app.mount('#app')
|
|
|
|
|