basic demo for i18n integration along with i18n-ally
This commit is contained in:
20
src/main.js
20
src/main.js
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user