feat:#60 added first example localization

This commit is contained in:
masterElmar
2023-11-14 23:22:56 +01:00
parent ac77664e3b
commit 3e1214d13b
6 changed files with 101 additions and 6 deletions

View File

@@ -18,6 +18,7 @@
"primeicons": "^6.0.1", "primeicons": "^6.0.1",
"primevue": "^3.32.2", "primevue": "^3.32.2",
"vue": "^3.3.4", "vue": "^3.3.4",
"vue-i18n": "^9.4.1",
"vue-router": "^4.2.4" "vue-router": "^4.2.4"
}, },
"devDependencies": { "devDependencies": {
@@ -584,6 +585,47 @@
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
"dev": true "dev": true
}, },
"node_modules/@intlify/core-base": {
"version": "9.4.1",
"resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-9.4.1.tgz",
"integrity": "sha512-WIwx+elsZbxSMxRG5+LC+utRohFvmZMoDevfKOfnYMLbpCjCSavqTfHJAtfsY6ruowzqXeKkeLhRHbYbjoJx5g==",
"dependencies": {
"@intlify/message-compiler": "9.4.1",
"@intlify/shared": "9.4.1"
},
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/kazupon"
}
},
"node_modules/@intlify/message-compiler": {
"version": "9.4.1",
"resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-9.4.1.tgz",
"integrity": "sha512-aN2N+dUx320108QhH51Ycd2LEpZ+NKbzyQ2kjjhqMcxhHdxtOnkgdx+MDBhOy/CObwBmhC3Nygzc6hNlfKvPNw==",
"dependencies": {
"@intlify/shared": "9.4.1",
"source-map-js": "^1.0.2"
},
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/kazupon"
}
},
"node_modules/@intlify/shared": {
"version": "9.4.1",
"resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-9.4.1.tgz",
"integrity": "sha512-A51elBmZWf1FS80inf/32diO9DeXoqg9GR9aUDHFcfHoNDuT46Q+fpPOdj8jiJnSHSBh8E1E+6qWRhAZXdK3Ng==",
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/kazupon"
}
},
"node_modules/@jridgewell/gen-mapping": { "node_modules/@jridgewell/gen-mapping": {
"version": "0.3.3", "version": "0.3.3",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
@@ -3525,6 +3567,25 @@
"eslint": ">=6.0.0" "eslint": ">=6.0.0"
} }
}, },
"node_modules/vue-i18n": {
"version": "9.4.1",
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.4.1.tgz",
"integrity": "sha512-vnQyYE9LBuNOqPpETIcCaGnAyLEqfeIvDcyZ9T+WBCWFTqWw1J8FuF1jfeDwpHBi5JKgAwgXyq1mt8jp/x/GPA==",
"dependencies": {
"@intlify/core-base": "9.4.1",
"@intlify/shared": "9.4.1",
"@vue/devtools-api": "^6.5.0"
},
"engines": {
"node": ">= 16"
},
"funding": {
"url": "https://github.com/sponsors/kazupon"
},
"peerDependencies": {
"vue": "^3.0.0"
}
},
"node_modules/vue-router": { "node_modules/vue-router": {
"version": "4.2.4", "version": "4.2.4",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.2.4.tgz", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.2.4.tgz",

View File

@@ -21,6 +21,7 @@
"primeicons": "^6.0.1", "primeicons": "^6.0.1",
"primevue": "^3.32.2", "primevue": "^3.32.2",
"vue": "^3.3.4", "vue": "^3.3.4",
"vue-i18n": "^9.4.1",
"vue-router": "^4.2.4" "vue-router": "^4.2.4"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -1,34 +1,36 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import { ref } from "vue";
import { useI18n } from "vue-i18n";
const {t} = useI18n({})
const items = ref([ const items = ref([
{ {
label: "Create Calendar", label: t('createCalendar'),
icon: "pi pi-fw pi-plus", icon: "pi pi-fw pi-plus",
url: "/", url: "/",
}, },
{ {
label: "Edit Calendar", label: t('editCalendar'),
icon: "pi pi-fw pi-pencil", icon: "pi pi-fw pi-pencil",
url: "/edit", url: "/edit",
}, },
{ {
label: "Check Room Availability", label: t('roomFinder'),
icon: "pi pi-fw pi-calendar", icon: "pi pi-fw pi-calendar",
url: "/rooms", url: "/rooms",
}, },
{ {
label: "FAQ", label: t('faq'),
icon: "pi pi-fw pi-book", icon: "pi pi-fw pi-book",
url: "/faq", url: "/faq",
}, },
{ {
label: "Imprint", label: t('imprint'),
icon: "pi pi-fw pi-id-card", icon: "pi pi-fw pi-id-card",
url: "/imprint", url: "/imprint",
}, },
{ {
label: "Privacy", label: t('privacy'),
url: "/privacy-policy", url: "/privacy-policy",
icon: "pi pi-fw pi-exclamation-triangle", icon: "pi pi-fw pi-exclamation-triangle",
}, },

View File

@@ -0,0 +1,11 @@
import { createI18n } from 'vue-i18n'
import messages from "./messages.ts";
const i18n = createI18n({
legacy: false,
globalInjection: true,
locale: 'en',
messages,
})
export default i18n

View File

@@ -0,0 +1,18 @@
export default {
en: {
createCalendar: 'Create Calendar',
editCalendar: 'Edit Calendar',
roomFinder: 'Room Finder',
faq: 'FAQ',
imprint: 'Imprint',
privacy: 'Privacy',
},
de: {
createCalendar: 'Kalender erstellen',
editCalendar: 'Kalender bearbeiten',
roomFinder: 'Raumfinder',
faq: 'FAQ',
imprint: 'Impressum',
privacy: 'Datenschutz',
}
}

View File

@@ -30,6 +30,7 @@ import Column from "primevue/column";
import DynamicDialog from "primevue/dynamicdialog"; import DynamicDialog from "primevue/dynamicdialog";
import DialogService from "primevue/dialogservice"; import DialogService from "primevue/dialogservice";
import ProgressSpinner from "primevue/progressspinner"; import ProgressSpinner from "primevue/progressspinner";
import i18n from "./i18n";
const app = createApp(App); const app = createApp(App);
const pinia = createPinia(); const pinia = createPinia();
@@ -39,6 +40,7 @@ app.use(router);
app.use(ToastService); app.use(ToastService);
app.use(pinia); app.use(pinia);
app.use(DialogService); app.use(DialogService);
app.use(i18n);
app.component("Button", Button); app.component("Button", Button);
app.component("Menu", Menu); app.component("Menu", Menu);
app.component("Menubar", Menubar); app.component("Menubar", Menubar);