basic demo for i18n integration along with i18n-ally

This commit is contained in:
2021-02-27 13:52:49 +01:00
parent 8bf08034b7
commit 63bb34ef99
6 changed files with 34 additions and 4 deletions

View File

@@ -1,8 +1,21 @@
import { createApp } from 'vue';
import { createWebHashHistory, createRouter } from 'vue-router';
import { createWebHistory, createWebHashHistory, createRouter } from 'vue-router';
import App from './App.vue';
import { createI18n } from 'vue-i18n';
import 'windi.css';
import 'toastify-js/src/toastify.css';
import * as keys_en from './locales/en.json';
import * as keys_de from './locales/de.json';
const messages = {
en: keys_en,
de: keys_de
};
const i18n = createI18n({
locale: 'de',
fallbackLocale: 'en',
messages
});
// ---------------
const Home = import('./components/Home.vue');
@@ -10,7 +23,8 @@ const Register = import('./components/Register.vue');
const Profile = import('./components/Profile.vue');
//
const router = createRouter({
history: createWebHashHistory(),
// history: createWebHashHistory(),
history: createWebHistory(),
routes: [
{ path: '/', component: Home },
{ path: '/register', component: Register },
@@ -18,4 +32,4 @@ const router = createRouter({
]
});
// ---------------
createApp(App).use(router).mount('#app');
createApp(App).use(i18n).use(router).mount('#app');