From bf1a90313db1b65d2a6a21529535e85c1a767067 Mon Sep 17 00:00:00 2001 From: Gerald Schmittinger Date: Fri, 16 May 2025 12:48:40 +0200 Subject: [PATCH] feat(frontend): Verbeteringen i18n en standaardleerpad bij het aanmaken --- frontend/src/controllers/learning-paths.ts | 4 ++-- frontend/src/i18n/locale/de.json | 6 +++++- frontend/src/i18n/locale/en.json | 6 +++++- frontend/src/i18n/locale/fr.json | 6 +++++- frontend/src/i18n/locale/nl.json | 6 +++++- frontend/src/queries/learning-paths.ts | 4 ++-- .../learning-paths/LearningPathPreviewCard.vue | 9 ++++----- 7 files changed, 28 insertions(+), 13 deletions(-) diff --git a/frontend/src/controllers/learning-paths.ts b/frontend/src/controllers/learning-paths.ts index c57e2087..1a1b0cc5 100644 --- a/frontend/src/controllers/learning-paths.ts +++ b/frontend/src/controllers/learning-paths.ts @@ -44,11 +44,11 @@ export class LearningPathController extends BaseController { return await this.get("/", { admin }); } - async postLearningPath(learningPath: LearningPathDTO): Promise { + async postLearningPath(learningPath: Partial): Promise { return await this.post("/", learningPath); } - async putLearningPath(learningPath: LearningPathDTO): Promise { + async putLearningPath(learningPath: Partial): Promise { return await this.put(`/${learningPath.hruid}/${learningPath.language}`, learningPath); } diff --git a/frontend/src/i18n/locale/de.json b/frontend/src/i18n/locale/de.json index b00938db..b187d248 100644 --- a/frontend/src/i18n/locale/de.json +++ b/frontend/src/i18n/locale/de.json @@ -162,5 +162,9 @@ "ownLearningContentTitle": "Eigene Lerninhalte", "ownLearningContentDescription": "Erstellen und verwalten Sie eigene Lernobjekte und Lernpfade. Nur für fortgeschrittene Nutzer.", "learningPathNotFound": "Dieser Lernpfad konnte nicht gefunden werden.", - "emptyLearningPath": "Dieser Lernpfad enthält keine Lernobjekte." + "emptyLearningPath": "Dieser Lernpfad enthält keine Lernobjekte.", + "pathContainsNonExistingLearningObjects": "Mindestens eines der in diesem Pfad referenzierten Lernobjekte existiert nicht.", + "targetAgesMandatory": "Zielalter müssen angegeben werden.", + "hintRemoveIfUnconditionalTransition": "(entfernen, wenn dies ein bedingungsloser Übergang sein soll)", + "hintKeywordsSeparatedBySpaces": "Schlüsselwörter durch Leerzeichen getrennt" } diff --git a/frontend/src/i18n/locale/en.json b/frontend/src/i18n/locale/en.json index 76082487..0754fc5a 100644 --- a/frontend/src/i18n/locale/en.json +++ b/frontend/src/i18n/locale/en.json @@ -162,5 +162,9 @@ "ownLearningContentTitle": "Own learning content", "ownLearningContentDescription": "Create and administrate your own learning objects and learning paths. For advanced users only.", "learningPathNotFound": "This learning path could not be found.", - "emptyLearningPath": "This learning path does not contain any learning objects." + "emptyLearningPath": "This learning path does not contain any learning objects.", + "pathContainsNonExistingLearningObjects": "At least one of the learning objects referenced in this path does not exist.", + "targetAgesMandatory": "Target ages must be specified.", + "hintRemoveIfUnconditionalTransition": "(remove this if this should be an unconditional transition)", + "hintKeywordsSeparatedBySpaces": "Keywords separated by spaces" } diff --git a/frontend/src/i18n/locale/fr.json b/frontend/src/i18n/locale/fr.json index e2e2a094..2714296c 100644 --- a/frontend/src/i18n/locale/fr.json +++ b/frontend/src/i18n/locale/fr.json @@ -163,5 +163,9 @@ "ownLearningContentTitle": "Contenu d’apprentissage personnel", "ownLearningContentDescription": "Créez et gérez vos propres objets et parcours d’apprentissage. Réservé aux utilisateurs avancés.", "learningPathNotFound": "Ce parcours d'apprentissage est introuvable.", - "emptyLearningPath": "Ce parcours d'apprentissage ne contient aucun objet d'apprentissage." + "emptyLearningPath": "Ce parcours d'apprentissage ne contient aucun objet d'apprentissage.", + "pathContainsNonExistingLearningObjects": "Au moins un des objets d’apprentissage référencés dans ce chemin n’existe pas.", + "targetAgesMandatory": "Les âges cibles doivent être spécifiés.", + "hintRemoveIfUnconditionalTransition": "(supprimer ceci s’il s’agit d’une transition inconditionnelle)", + "hintKeywordsSeparatedBySpaces": "Mots-clés séparés par des espaces" } diff --git a/frontend/src/i18n/locale/nl.json b/frontend/src/i18n/locale/nl.json index 3bfacea7..c4409d1b 100644 --- a/frontend/src/i18n/locale/nl.json +++ b/frontend/src/i18n/locale/nl.json @@ -162,5 +162,9 @@ "ownLearningContentTitle": "Eigen leerinhoud", "ownLearningContentDescription": "Maak en beheer je eigen leerobjecten en leerpads. Alleen voor gevorderde gebruikers.", "learningPathNotFound": "Dit leerpad kon niet gevonden worden.", - "emptyLearningPath": "Dit leerpad bevat geen leerobjecten." + "emptyLearningPath": "Dit leerpad bevat geen leerobjecten.", + "pathContainsNonExistingLearningObjects": "Ten minste één van de leerobjecten in dit pad bestaat niet.", + "targetAgesMandatory": "Doelleeftijden moeten worden opgegeven.", + "hintRemoveIfUnconditionalTransition": "(verwijder dit voor onvoorwaardelijke overgangen)", + "hintKeywordsSeparatedBySpaces": "Trefwoorden gescheiden door spaties" } diff --git a/frontend/src/queries/learning-paths.ts b/frontend/src/queries/learning-paths.ts index dd5900a3..80d59afa 100644 --- a/frontend/src/queries/learning-paths.ts +++ b/frontend/src/queries/learning-paths.ts @@ -54,7 +54,7 @@ export function useGetAllLearningPathsByAdminQuery( export function usePostLearningPathMutation(): UseMutationReturnType< LearningPathDTO, AxiosError, - { learningPath: LearningPathDTO }, + { learningPath: Partial }, unknown > { const queryClient = useQueryClient(); @@ -68,7 +68,7 @@ export function usePostLearningPathMutation(): UseMutationReturnType< export function usePutLearningPathMutation(): UseMutationReturnType< LearningPathDTO, AxiosError, - { learningPath: LearningPathDTO }, + { learningPath: Partial }, unknown > { const queryClient = useQueryClient(); diff --git a/frontend/src/views/own-learning-content/learning-paths/LearningPathPreviewCard.vue b/frontend/src/views/own-learning-content/learning-paths/LearningPathPreviewCard.vue index f61164ae..929a72d1 100644 --- a/frontend/src/views/own-learning-content/learning-paths/LearningPathPreviewCard.vue +++ b/frontend/src/views/own-learning-content/learning-paths/LearningPathPreviewCard.vue @@ -21,7 +21,7 @@ const { isPending, mutate, error: deleteError, isSuccess: deleteSuccess } = useDeleteLearningPathMutation(); - const DEFAULT_LEARNING_PATH: LearningPath = { + const DEFAULT_LEARNING_PATH: Partial = { language: "en", hruid: "...", title: "...", @@ -35,7 +35,7 @@ transitions: [ { default: true, - condition: "(remove if the transition should be unconditinal)", + condition: t("hintRemoveIfUnconditionalTransition"), next: { hruid: "...", version: 1, @@ -45,14 +45,13 @@ ], }, ], - keywords: "Keywords separated by spaces", - target_ages: [], + keywords: t("hintKeywordsSeparatedBySpaces") }; const { isPending: isPostPending, error: postError, mutate: doPost } = usePostLearningPathMutation(); const { isPending: isPutPending, error: putError, mutate: doPut } = usePutLearningPathMutation(); - const learningPath: Ref = ref(DEFAULT_LEARNING_PATH); + const learningPath: Ref | string> = ref(DEFAULT_LEARNING_PATH); const parsedLearningPath = computed(() => typeof learningPath.value === "string" ? (JSON.parse(learningPath.value) as LearningPath) : learningPath.value,