From f6b3ffe854907009b34ac3c1aa7ab944628fc500 Mon Sep 17 00:00:00 2001 From: masterElmar <18119527+masterElmar@users.noreply.github.com> Date: Thu, 16 Nov 2023 11:57:33 +0100 Subject: [PATCH] feat:#60 added more localization --- frontend/src/components/CalendarLink.vue | 17 ++++---- frontend/src/components/CourseSelection.vue | 7 +++- .../src/components/ModuleTemplateDialog.vue | 32 ++++++++------- frontend/src/components/RenameModules.vue | 23 ++++++----- frontend/src/i18n/translations/de.json | 39 +++++++++++++++++-- frontend/src/i18n/translations/en.json | 35 ++++++++++++++++- 6 files changed, 113 insertions(+), 40 deletions(-) diff --git a/frontend/src/components/CalendarLink.vue b/frontend/src/components/CalendarLink.vue index bff49e1..a8a7a40 100644 --- a/frontend/src/components/CalendarLink.vue +++ b/frontend/src/components/CalendarLink.vue @@ -3,6 +3,9 @@ import tokenStore from "../store/tokenStore.ts"; import { useToast } from "primevue/usetoast"; import { onMounted } from "vue"; import router from "../router"; +import { useI18n } from "vue-i18n"; +const { t } = useI18n({ useScope: 'global' }) + const toast = useToast(); const domain = window.location.hostname; @@ -12,8 +15,8 @@ const getLink = () => "https://" + domain + "/api/feed?token=" + tokenStore().to const show = () => { toast.add({ severity: "info", - summary: "Info", - detail: "Link copied to clipboard", + summary: t('calendarLink.copyToastSummary'), + detail: t('calendarLink.copyToastNotification'), life: 3000, }); }; @@ -36,8 +39,8 @@ function copyToClipboard() { console.error("Could not copy text: ", err); toast.add({ severity: "error", - summary: "Error", - detail: "Could not copy text", + summary: t('calendarLink.copyToastError'), + detail: t('calendarLink.copyToastErrorDetail'), life: 3000, }); }, @@ -54,17 +57,17 @@ const forwardToMicrosoft = () => { const actions = [ { - label: "Copy to Clipboard", + label: t('calendarLink.copyToClipboard'), icon: "pi pi-copy", command: copyToClipboard, }, { - label: "To Google Calendar", + label: t('calendarLink.toGoogleCalendar'), icon: "pi pi-google", command: forwardToGoogle, }, { - label: "To Microsoft Calendar", + label: t('calendarLink.toMicrosoftCalendar'), icon: "pi pi-microsoft", command: forwardToMicrosoft, }, diff --git a/frontend/src/components/CourseSelection.vue b/frontend/src/components/CourseSelection.vue index 24a1c03..b90e702 100644 --- a/frontend/src/components/CourseSelection.vue +++ b/frontend/src/components/CourseSelection.vue @@ -1,5 +1,5 @@ @@ -28,20 +32,18 @@ const placeholders = ref([ aria-label="Help" @click="helpVisible = true" /> - +

- Here you can rename your modules to your liking. This will be the name of - the event in your calendar. + {{ t('moduleTemplateDialog.explanationOne')}}

-

You can use the following placeholders in your module names:

+

{{ t('moduleTemplateDialog.tableDescription')}}

- - - + + +

- Additionally, you can toggle notifications for each module. If you do so, - you will be notified 15 minutes before the event starts. + {{ t('moduleTemplateDialog.explanationTwo')}}

diff --git a/frontend/src/components/RenameModules.vue b/frontend/src/components/RenameModules.vue index 8a6e620..6f7d7a1 100644 --- a/frontend/src/components/RenameModules.vue +++ b/frontend/src/components/RenameModules.vue @@ -3,9 +3,12 @@ import moduleStore from "../store/moduleStore.ts"; import { createIndividualFeed } from "../api/createFeed.ts"; import router from "../router"; import tokenStore from "../store/tokenStore.ts"; -import { ref } from "vue"; +import { computed, ref } from "vue"; import ModuleTemplateDialog from "./ModuleTemplateDialog.vue"; import { onlyWhitespace } from "../helpers/strings.ts"; +import { useI18n } from "vue-i18n"; +const { t } = useI18n({ useScope: 'global' }) + const tableData = ref( moduleStore().modules.map((module) => { @@ -16,10 +19,10 @@ const tableData = ref( }), ); -const columns = ref([ - { field: "Course", header: "Course" }, - { field: "Module", header: "Module" }, - { field: "Reminder", header: "Reminder" }, +const columns = computed(() => [ + { field: "Course", header: t('moduleInformation.course') }, + { field: "Module", header: t('moduleInformation.module') }, + { field: "Reminder", header: t('renameModules.reminder') }, ]); async function finalStep() { @@ -32,7 +35,7 @@ async function finalStep() {