feat:#69 added translation for edit pages

This commit is contained in:
masterElmar
2023-11-20 18:33:07 +01:00
parent ecb43abd6a
commit bdf95059dd
5 changed files with 38 additions and 24 deletions

View File

@@ -1,13 +1,16 @@
<script lang="ts" setup> <script lang="ts" setup>
import { defineAsyncComponent, ref, Ref } from "vue"; import { defineAsyncComponent, ref, Ref } from "vue";
import { Module } from "../../model/module"; import { Module } from "@/model/module.ts";
import { fetchAllModules } from "../../api/fetchCourse"; import { fetchAllModules } from "@/api/fetchCourse.ts";
import moduleStore from "../../store/moduleStore"; import moduleStore from "../../store/moduleStore";
import { MultiSelectAllChangeEvent } from "primevue/multiselect"; import { MultiSelectAllChangeEvent } from "primevue/multiselect";
import router from "../../router"; import router from "../../router";
import { fetchModule } from "../../api/fetchModule"; import { fetchModule } from "@/api/fetchModule.ts";
import { useDialog } from "primevue/usedialog"; import { useDialog } from "primevue/usedialog";
import {useI18n} from "vue-i18n";
const dialog = useDialog(); const dialog = useDialog();
const { t } = useI18n({ useScope: "global" });
const fetchedModules = async () => { const fetchedModules = async () => {
return await fetchAllModules(); return await fetchAllModules();
@@ -70,14 +73,21 @@ const onSelectAllChange = (event: MultiSelectAllChangeEvent) => {
function selectChange() { function selectChange() {
selectAll.value = selectedModules.value.length === modules.value.length; selectAll.value = selectedModules.value.length === modules.value.length;
} }
function itemsLabel(selectedModules: Module[]): string {
return (selectedModules ? selectedModules.length : 0) != 1 ? t("additionalModules.modules") : t("additionalModules.module");
}
function itemsLabelWithNumber(selectedModules: Module[]): string {
return selectedModules.length.toString() + " " + itemsLabel(selectedModules) + " " + t("additionalModules.dropDownFooterSelected");
}
</script> </script>
<template> <template>
<div class="flex flex-column"> <div class="flex flex-column">
<div class="flex align-items-center justify-content-center h-4rem m-2"> <div class="flex align-items-center justify-content-center h-4rem m-2">
<h3> <h3>
Select additional Modules that are not listed in the regular semester {{ $t("additionalModules.subTitle") }}
for your Course
</h3> </h3>
</div> </div>
<div class="card flex align-items-center justify-content-center m-2"> <div class="card flex align-items-center justify-content-center m-2">
@@ -90,10 +100,12 @@ function selectChange() {
:virtual-scroller-options="{ itemSize: 70 }" :virtual-scroller-options="{ itemSize: 70 }"
class="custom-multiselect" class="custom-multiselect"
filter filter
placeholder="Select additional modules" :placeholder="$t('additionalModules.dropDown')"
:auto-filter-focus="true" :auto-filter-focus="true"
:show-toggle-all="false"
@change="selectChange()" @change="selectChange()"
@selectall-change="onSelectAllChange($event)" @selectall-change="onSelectAllChange($event)"
:selectedItemsLabel="itemsLabelWithNumber(selectedModules)"
> >
<template #option="slotProps"> <template #option="slotProps">
<div class="flex justify-content-between w-full"> <div class="flex justify-content-between w-full">
@@ -127,7 +139,7 @@ function selectChange() {
</MultiSelect> </MultiSelect>
</div> </div>
<div class="flex align-items-center justify-content-center h-4rem m-2"> <div class="flex align-items-center justify-content-center h-4rem m-2">
<Button @click="nextStep()">Next Step</Button> <Button @click="nextStep()">{{ $t("additionalModules.nextStep") }}</Button>
</div> </div>
</div> </div>
</template> </template>

View File

@@ -1,13 +1,15 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, Ref, ref } from "vue"; import { computed, Ref, ref } from "vue";
import { Module } from "../../model/module"; import { Module } from "@/model/module.ts";
import moduleStore from "../../store/moduleStore"; import moduleStore from "../../store/moduleStore";
import { fetchAllModules } from "../../api/fetchCourse"; import { fetchAllModules } from "@/api/fetchCourse.ts";
import { saveIndividualFeed } from "../../api/createFeed"; import { saveIndividualFeed } from "@/api/createFeed.ts";
import tokenStore from "../../store/tokenStore"; import tokenStore from "../../store/tokenStore";
import router from "../../router"; import router from "../../router";
import ModuleTemplateDialog from "../ModuleTemplateDialog.vue"; import ModuleTemplateDialog from "../ModuleTemplateDialog.vue";
import { onlyWhitespace } from "../../helpers/strings.ts"; import { onlyWhitespace } from "@/helpers/strings.ts";
import { useI18n } from "vue-i18n";
const { t } = useI18n({ useScope: "global" });
const tableData = computed(() => const tableData = computed(() =>
moduleStore().modules.map((module: Module) => { moduleStore().modules.map((module: Module) => {
@@ -19,9 +21,9 @@ const tableData = computed(() =>
); );
const columns = ref([ const columns = ref([
{ field: "Course", header: "Course" }, { field: "Course", header: t("moduleInformation.course") },
{ field: "Module", header: "Module" }, { field: "Module", header: t("moduleInformation.module") },
{ field: "Reminder", header: "Reminder" }, { field: "Reminder", header: t("renameModules.reminder") },
]); ]);
const fetchedModules = async () => { const fetchedModules = async () => {
@@ -51,7 +53,7 @@ async function finalStep() {
<template> <template>
<div class="flex flex-column card-container mx-8 mt-2"> <div class="flex flex-column card-container mx-8 mt-2">
<div class="flex align-items-center justify-content-center h-4rem m-2"> <div class="flex align-items-center justify-content-center h-4rem m-2">
<h3>Rename your selected Modules to your liking.</h3> <h3>{{ $t("renameModules.subTitle") }}</h3>
<ModuleTemplateDialog /> <ModuleTemplateDialog />
</div> </div>
<div <div
@@ -65,7 +67,7 @@ async function finalStep() {
> >
<template #header> <template #header>
<div class="flex align-items-center justify-content-end"> <div class="flex align-items-center justify-content-end">
Enable all notifications: {{ $t("renameModules.enableAllNotifications") }}
<InputSwitch <InputSwitch
class="mx-4" class="mx-4"
:model-value=" :model-value="
@@ -152,7 +154,7 @@ async function finalStep() {
<div <div
class="flex align-items-center justify-content-center border-round m-2" class="flex align-items-center justify-content-center border-round m-2"
> >
<Button label="Save Calendar" @click="finalStep()" /> <Button @click="finalStep()" >{{ $t("renameModules.nextStep") }}</Button>
</div> </div>
</div> </div>
</template> </template>

View File

@@ -63,7 +63,7 @@
"reminder": "Erinnerung", "reminder": "Erinnerung",
"enableAllNotifications": "Alle Benachrichtigungen aktivieren", "enableAllNotifications": "Alle Benachrichtigungen aktivieren",
"subTitle": "Konfigurieren Sie die ausgewählten Module nach Ihren Wünschen.", "subTitle": "Konfigurieren Sie die ausgewählten Module nach Ihren Wünschen.",
"nextStep": "Weiter" "nextStep": "Speichern"
}, },
"moduleTemplateDialog": { "moduleTemplateDialog": {
"explanationOne": "Hier können Module nach Wunsch umbenannt werden, welche dann als Anzeigename im Kalender dargestellt werden.", "explanationOne": "Hier können Module nach Wunsch umbenannt werden, welche dann als Anzeigename im Kalender dargestellt werden.",

View File

@@ -63,7 +63,7 @@
"reminder": "reminder", "reminder": "reminder",
"enableAllNotifications": "enable all notifications", "enableAllNotifications": "enable all notifications",
"subTitle": "Configure your selected Modules to your liking.", "subTitle": "Configure your selected Modules to your liking.",
"nextStep": "next step" "nextStep": "Save"
}, },
"moduleTemplateDialog": { "moduleTemplateDialog": {
"explanationOne": "Here you can rename your modules to your liking. This will be the name of the event in your calendar.", "explanationOne": "Here you can rename your modules to your liking. This will be the name of the event in your calendar.",

View File

@@ -131,16 +131,16 @@ function itemsLabelWithNumber(selectedModules: Module[]): string {
<template #footer> <template #footer>
<div class="py-2 px-3"> <div class="py-2 px-3">
<b>{{ selectedModules ? selectedModules.length : 0 }}</b> <b>{{ selectedModules ? selectedModules.length : 0 }}</b>
{{ itemsLabel(selectedModules) }} item{{
{{ $t("additionalModules.dropDownFooterSelected") }} (selectedModules ? selectedModules.length : 0) > 1 ? "s" : ""
}}
selected.
</div> </div>
</template> </template>
</MultiSelect> </MultiSelect>
</div> </div>
<div class="flex align-items-center justify-content-center h-4rem m-2"> <div class="flex align-items-center justify-content-center h-4rem m-2">
<Button @click="nextStep()">{{ <Button @click="nextStep()">{{ $t("additionalModules.nextStep") }}</Button>
$t("additionalModules.nextStep")
}}</Button>
</div> </div>
</div> </div>
</template> </template>