From 1de9134b2a9607bc9cc8f92e1ac59b132319a0ef Mon Sep 17 00:00:00 2001 From: Candid Dauth Date: Fri, 5 Apr 2024 13:48:26 +0200 Subject: [PATCH] Translate history-dialog --- frontend/src/i18n/de.json | 73 ++++++++++ frontend/src/i18n/en.json | 73 ++++++++++ .../facil-map-context-provider.vue | 2 +- .../history-dialog/history-dialog.vue | 24 ++-- .../history-dialog/history-utils.ts | 126 ++++++++++++++---- frontend/src/lib/utils/i18n.ts | 6 +- 6 files changed, 265 insertions(+), 39 deletions(-) diff --git a/frontend/src/i18n/de.json b/frontend/src/i18n/de.json index 61402d21..03d058d5 100644 --- a/frontend/src/i18n/de.json +++ b/frontend/src/i18n/de.json @@ -148,6 +148,79 @@ "option-reorder": "Umordnen", "option-add": "Erstellen" }, + "history-dialog": { + "loading-error": "Fehler beim Laden der Versionsgeschichte", + "revert-error": "Fehler beim Rückgängigmachen der Änderung", + "title": "Versionsgeschichte", + "introduction": "Hier können Sie die letzten 50 Änderungen der Karte inspizieren und rückgängig machen.", + "date": "Zeit", + "action": "Änderung", + "restore": "Wiederherstellen", + "diff-field": "Attribut", + "diff-before": "Vorher", + "diff-after": "Nachher" + }, + "history-utils": { + "description-create-marker": "Marker {{id}} {{quotedName}} erstellt", + "description-create-line": "Linie {{id}} {{quotedName}} erstellt", + "description-create-view": "Ansicht {{id}} {{quotedName}} erstellt", + "description-create-type": "Objekttyp {{id}} {{quotedName}} erstellt", + "description-update-map": "Karteneinstellungen geändert", + "description-update-marker": "Marker {{id}} {{quotedName}} geändert", + "description-update-line": "Linie {{id}} {{quotedName}} geändert", + "description-update-view": "Ansicht {{id}} {{quotedName}} geändert", + "description-update-type": "Objekttyp {{id}} {{quotedName}} geändert", + "description-delete-marker": "Marker {{id}} {{quotedName}} gelöscht", + "description-delete-line": "Linie {{id}} {{quotedName}} gelöscht", + "description-delete-view": "Ansicht {{id}} {{quotedName}} gelöscht", + "description-delete-type": "Objekttyp {{id}} {{quotedName}} gelöscht", + "description-interpolation-quotedName": "„{{name}}“", + "description-interpolation-quotedName-renamed": "{{quotedBefore}} (neu: {{quotedAfter}})", + "revert-create": "Löschen", + "revert-create-marker-title": "Marker löschen", + "revert-create-line-title": "Linie löschen", + "revert-create-view-title": "Ansicht löschen", + "revert-create-type-title": "Typ löschen", + "revert-create-marker-message-named": "Wollen Sie den Marker {{quotedName}} wirklich löschen?", + "revert-create-marker-message-unnamed": "Wollen Sie diesen Marker wirklich löschen?", + "revert-create-line-message-named": "Wollen Sie die Linie {{quotedName}} wirklich löschen?", + "revert-create-line-message-unnamed": "Wollen Sie diese Linie wirklich löschen?", + "revert-create-view-message-named": "Wollen Sie die Ansicht {{quotedName}} wirklich löschen?", + "revert-create-view-message-unnamed": "Wollen Sie diese Ansicht wirklich löschen?", + "revert-create-type-message-named": "Wollen Sie den Objekttyp {{quotedName}} wirklich löschen?", + "revert-create-type-message-unnamed": "Wollen Sie diesen Objekttyp wirklich löschen?", + "revert-create-button": "Löschen", + "revert-update": "Wiederherstellen", + "revert-update-map-title": "Karteneinstellungen wiederherstellen", + "revert-update-marker-title": "Marker wiederherstellen", + "revert-update-line-title": "Linie wiederherstellen", + "revert-update-view-title": "Ansicht wiederherstellen", + "revert-update-type-title": "Objekttyp wiederherstellen", + "revert-update-map-message": "Wollen Sie die alte Version der Karteneinstellungen wirklich wiederherstellen?", + "revert-update-marker-message-named": "Wollen Sie die alte Version des Markers {{quotedName}} wirklich wiederherstellen?", + "revert-update-marker-message-unnamed": "Wollen Sie die alte Version dieses Markers wirklich wiederherstellen?", + "revert-update-line-message-named": "Wollen Sie die alte Version der Linie {{quotedName}} wirklich wiederherstellen?", + "revert-update-line-message-unnamed": "Wollen Sie die alte Version dieser Linie wirklich wiederherstellen?", + "revert-update-view-message-named": "Wollen Sie die alte Version der Ansicht {{quotedName}} wirklich wiederherstellen?", + "revert-update-view-message-unnamed": "Wollen Sie die alte Version dieser Ansicht wirklich wiederherstellen?", + "revert-update-type-message-named": "Wollen Sie die alte Version des Objekttyps {{quotedName}} wirklich wiederherstellen?", + "revert-update-type-message-unnamed": "Wollen Sie die alte Version dieses Objekttyps wirklich wiederherstellen?", + "revert-update-button": "Wiederherstellen", + "revert-delete": "Wiederherstellen", + "revert-delete-marker-title": "Marker wiederherstellen", + "revert-delete-line-title": "Linie wiederherstellen", + "revert-delete-view-title": "Ansicht wiederherstellen", + "revert-delete-type-title": "Objekttype wiederherstellen", + "revert-delete-marker-message-named": "Wollen Sie die alte Version des Markers {{quotedName}} wirklich wiederherstellen?", + "revert-delete-marker-message-unnamed": "Wollen Sie die alte Version dieses Markers wirklich wiederherstellen?", + "revert-delete-line-message-named": "Wollen Sie die alte Version der Linie {{quotedName}} wirklich wiederherstellen?", + "revert-delete-line-message-unnamed": "Wollen Sie die alte Version dieser Linie wirklich wiederherstellen?", + "revert-delete-view-message-named": "Wollen Sie die alte Version der Ansicht {{quotedName}} wirklich wiederherstellen?", + "revert-delete-view-message-unnamed": "Wollen Sie die alte Version dieser Ansicht wirklich wiederherstellen?", + "revert-delete-type-message-named": "Wollen Sie die alte Version des Objekttyps {{quotedName}} wirklich wiederherstellen?", + "revert-delete-type-message-unnamed": "Wollen Sie die alte Version dieses Objekttyps wirklich wiederherstellen?", + "revert-delete-button": "Wiederherstellen" + }, "modal-dialog": { "close": "Schließen", "cancel": "Abbrechen", diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index e1f8d235..c46e005d 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -148,6 +148,79 @@ "option-reorder": "Reorder", "option-add": "Add" }, + "history-dialog": { + "loading-error": "Error loading history", + "revert-error": "Error reverting history entry", + "title": "History", + "introduction": "Here you can inspect and revert the last 50 changes to the map.", + "date": "Date", + "action": "Action", + "restore": "Restore", + "diff-field": "Field", + "diff-before": "Before", + "diff-after": "After" + }, + "history-utils": { + "description-create-marker": "Created marker {{id}} {{quotedName}}", + "description-create-line": "Created line {{id}} {{quotedName}}", + "description-create-view": "Created view {{id}} {{quotedName}}", + "description-create-type": "Created type {{id}} {{quotedName}}", + "description-update-map": "Changed map settings", + "description-update-marker": "Changed marker {{id}} {{quotedName}}", + "description-update-line": "Changed line {{id}} {{quotedName}}", + "description-update-view": "Changed view {{id}} {{quotedName}}", + "description-update-type": "Changed type {{id}} {{quotedName}}", + "description-delete-marker": "Deleted marker {{id}} {{quotedName}}", + "description-delete-line": "Deleted line {{id}} {{quotedName}}", + "description-delete-view": "Deleted view {{id}} {{quotedName}}", + "description-delete-type": "Deleted type {{id}} {{quotedName}}", + "description-interpolation-quotedName": "“{{name}}”", + "description-interpolation-quotedName-renamed": "{{quotedBefore}} (new name: {{quotedAfter}})", + "revert-create": "Revert (delete)", + "revert-create-marker-title": "Delete marker", + "revert-create-line-title": "Delete line", + "revert-create-view-title": "Delete view", + "revert-create-type-title": "Delete type", + "revert-create-marker-message-named": "Do you really want to delete the marker {{quotedName}}?", + "revert-create-marker-message-unnamed": "Do you really want to delete this marker?", + "revert-create-line-message-named": "Do you really want to delete the line {{quotedName}}?", + "revert-create-line-message-unnamed": "Do you really want to delete this line?", + "revert-create-view-message-named": "Do you really want to delete the view {{quotedName}}?", + "revert-create-view-message-unnamed": "Do you really want to delete this view?", + "revert-create-type-message-named": "Do you really want to delete the type {{quotedName}}?", + "revert-create-type-message-unnamed": "Do you really want to delete this type?", + "revert-create-button": "Delete", + "revert-update": "Revert", + "revert-update-map-title": "Revert map settings", + "revert-update-marker-title": "Revert marker", + "revert-update-line-title": "Revert line", + "revert-update-view-title": "Revert view", + "revert-update-type-title": "Revert type", + "revert-update-map-message": "Do you really want to restore the old version of the map settings?", + "revert-update-marker-message-named": "Do you really want to restore the old version of the marker {{quotedName}}?", + "revert-update-marker-message-unnamed": "Do you really want to restore the old version of this marker?", + "revert-update-line-message-named": "Do you really want to restore the old version of the line {{quotedName}}?", + "revert-update-line-message-unnamed": "Do you really want to restore the old version of this line?", + "revert-update-view-message-named": "Do you really want to restore the old version of the view {{quotedName}}?", + "revert-update-view-message-unnamed": "Do you really want to restore the old version of this view?", + "revert-update-type-message-named": "Do you really want to restore the old version of the type {{quotedName}}?", + "revert-update-type-message-unnamed": "Do you really want to restore the old version of this type?", + "revert-update-button": "Revert", + "revert-delete": "Restore", + "revert-delete-marker-title": "Restore marker", + "revert-delete-line-title": "Restore line", + "revert-delete-view-title": "Restore view", + "revert-delete-type-title": "Restore type", + "revert-delete-marker-message-named": "Do you really want to restore the marker {{quotedName}}?", + "revert-delete-marker-message-unnamed": "Do you really want to restore this marker?", + "revert-delete-line-message-named": "Do you really want to restore the line {{quotedName}}?", + "revert-delete-line-message-unnamed": "Do you really want to restore this line?", + "revert-delete-view-message-named": "Do you really want to restore the view {{quotedName}}?", + "revert-delete-view-message-unnamed": "Do you really want to restore this view?", + "revert-delete-type-message-named": "Do you really want to restore the type {{quotedName}}?", + "revert-delete-type-message-unnamed": "Do you really want to restore this type?", + "revert-delete-button": "Restore" + }, "modal-dialog": { "close": "Close", "cancel": "Cancel", diff --git a/frontend/src/lib/components/facil-map-context-provider/facil-map-context-provider.vue b/frontend/src/lib/components/facil-map-context-provider/facil-map-context-provider.vue index 7ba12160..db9c1917 100644 --- a/frontend/src/lib/components/facil-map-context-provider/facil-map-context-provider.vue +++ b/frontend/src/lib/components/facil-map-context-provider/facil-map-context-provider.vue @@ -51,7 +51,7 @@ function provideComponent(key: K, componentRef: Readonly>) { if (key in components) { - throw new Error(`Component "${key}"" is already provided.`); + throw new Error(`Component "${key}" is already provided.`); } watch(componentRef, (component) => { diff --git a/frontend/src/lib/components/history-dialog/history-dialog.vue b/frontend/src/lib/components/history-dialog/history-dialog.vue index a38beb79..60b87da1 100644 --- a/frontend/src/lib/components/history-dialog/history-dialog.vue +++ b/frontend/src/lib/components/history-dialog/history-dialog.vue @@ -11,6 +11,7 @@ import Popover from "../ui/popover.vue"; import ModalDialog from "../ui/modal-dialog.vue"; import { injectContextRequired, requireClientContext } from "../facil-map-context-provider/facil-map-context-provider.vue"; + import { useI18n } from "../../utils/i18n"; type HistoryEntryWithLabels = HistoryEntry & { labels: HistoryEntryLabels; @@ -20,6 +21,7 @@ const client = requireClientContext(context); const toasts = useToasts(); + const i18n = useI18n(); const emit = defineEmits<{ hidden: []; @@ -37,7 +39,7 @@ try { await client.value.listenToHistory(); } catch (err) { - toasts.showErrorToast(`${id}-listen-error`, "Error loading history", err); + toasts.showErrorToast(`${id}-listen-error`, i18n.t("history-dialog.loading-error"), err); } finally { isLoading.value = false; } @@ -55,7 +57,7 @@ toasts.hideToast(`${id}-revert-error`); if (!await showConfirm({ - title: entry.labels.revert!.button, + title: entry.labels.revert!.title, message: entry.labels.revert!.message, variant: "warning", okLabel: entry.labels.revert!.okLabel @@ -67,7 +69,7 @@ try { await client.value.revertHistoryEntry({ id: entry.id }); } catch (err) { - toasts.showErrorToast(`${id}-revert-error`, "Error loading history", err); + toasts.showErrorToast(`${id}-revert-error`, i18n.t("history-dialog.revert-error"), err); } finally { isReverting.value = undefined; } @@ -96,23 +98,23 @@