[tmp] vue i18n error
This commit is contained in:
43
src/main.js
43
src/main.js
@@ -1,49 +1,10 @@
|
||||
import { createApp } from 'vue';
|
||||
import { createWebHistory, createRouter } from 'vue-router';
|
||||
import App from './App.vue';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import Toast from 'vue-toastification';
|
||||
import 'windi.css';
|
||||
import 'toastify-js/src/toastify.css';
|
||||
import 'vue-toastification/dist/index.css';
|
||||
import * as keys_en from './locales/en.json';
|
||||
import * as keys_de from './locales/de.json';
|
||||
import { router } from './router';
|
||||
import { i18n } from './language';
|
||||
|
||||
const messages = {
|
||||
en: keys_en,
|
||||
de: keys_de
|
||||
};
|
||||
const browserlocale = ((navigator.languages && navigator.languages[0]) || '').substr(0, 2);
|
||||
const i18n = createI18n({
|
||||
locale: browserlocale,
|
||||
fallbackLocale: 'en',
|
||||
messages
|
||||
});
|
||||
|
||||
// ---------------
|
||||
const EnvError = import('./components/EnvError.vue');
|
||||
const Home = import('./components/Home.vue');
|
||||
const Imprint = import('./components/Imprint.vue');
|
||||
const Privacy = import('./components/Privacy.vue');
|
||||
const Register = () => import('./components/Register.vue');
|
||||
const Profile = () => import('./components/Profile.vue');
|
||||
//
|
||||
let routes = [ { path: '/:pathMatch(.*)*', component: EnvError } ];
|
||||
if (typeof config !== 'undefined') {
|
||||
if (config.baseurl && config.documentserver_key) {
|
||||
routes = [
|
||||
{ path: '/', component: Home },
|
||||
{ path: '/imprint', component: Imprint },
|
||||
{ path: '/privacy', component: Privacy },
|
||||
{ path: '/register', component: Register },
|
||||
{ path: '/register/:token', component: Register, props: true },
|
||||
{ path: '/profile/:token', component: Profile, props: true }
|
||||
];
|
||||
}
|
||||
}
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes
|
||||
});
|
||||
// ---------------
|
||||
createApp(App).use(Toast).use(i18n).use(router).mount('#app');
|
||||
|
||||
Reference in New Issue
Block a user