basic demo for i18n integration along with i18n-ally
This commit is contained in:
parent
8bf08034b7
commit
63bb34ef99
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"i18n-ally.localesPaths": [
|
||||||
|
"src/locales"
|
||||||
|
]
|
||||||
|
}
|
|
@ -12,6 +12,7 @@
|
||||||
"toastify-js": "^1.9.3",
|
"toastify-js": "^1.9.3",
|
||||||
"validator": "^13.5.2",
|
"validator": "^13.5.2",
|
||||||
"vue": "^3.0.5",
|
"vue": "^3.0.5",
|
||||||
|
"vue-i18n": "^9.0.0",
|
||||||
"vue-phone-number-input": "^1.1.10",
|
"vue-phone-number-input": "^1.1.10",
|
||||||
"vue-router": "4"
|
"vue-router": "4"
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
>Lauf für Kaya! - Registrieren</h1>
|
>Lauf für Kaya! - Registrieren</h1>
|
||||||
<p
|
<p
|
||||||
class="mx-auto leading-relaxed text-base text-center"
|
class="mx-auto leading-relaxed text-base text-center"
|
||||||
>Jetzt für den Lauf für Kaya! 2021 registrieren.</p>
|
>{{ $t('register.register_now') }}</p>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<label for="first_name" class="block font-medium">
|
<label for="first_name" class="block font-medium">
|
||||||
Vorname
|
Vorname
|
||||||
|
|
5
src/locales/de.json
Normal file
5
src/locales/de.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"register": {
|
||||||
|
"register_now": "Jetzt für den Lauf für Kaya! 2021 registrieren."
|
||||||
|
}
|
||||||
|
}
|
5
src/locales/en.json
Normal file
5
src/locales/en.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"register": {
|
||||||
|
"register_now": "Register now for Lauf für Kaya! 2021."
|
||||||
|
}
|
||||||
|
}
|
20
src/main.js
20
src/main.js
|
@ -1,8 +1,21 @@
|
||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import { createWebHashHistory, createRouter } from 'vue-router';
|
import { createWebHistory, createWebHashHistory, createRouter } from 'vue-router';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
import { createI18n } from 'vue-i18n';
|
||||||
import 'windi.css';
|
import 'windi.css';
|
||||||
import 'toastify-js/src/toastify.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');
|
const Home = import('./components/Home.vue');
|
||||||
|
@ -10,7 +23,8 @@ const Register = import('./components/Register.vue');
|
||||||
const Profile = import('./components/Profile.vue');
|
const Profile = import('./components/Profile.vue');
|
||||||
//
|
//
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHashHistory(),
|
// history: createWebHashHistory(),
|
||||||
|
history: createWebHistory(),
|
||||||
routes: [
|
routes: [
|
||||||
{ path: '/', component: Home },
|
{ path: '/', component: Home },
|
||||||
{ path: '/register', component: Register },
|
{ 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');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user