From 38b4b3953d01b71265acbc4068d7c683c4dece5e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 28 Nov 2024 23:31:06 +0200 Subject: [PATCH] feat(i18n): translate import toast messages --- src/public/app/services/import.js | 11 ++++++----- src/public/translations/en/translation.json | 5 ++++- src/public/translations/ro/translation.json | 5 ++++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/public/app/services/import.js b/src/public/app/services/import.js index 715380ed8..6cc3aebe7 100644 --- a/src/public/app/services/import.js +++ b/src/public/app/services/import.js @@ -3,6 +3,7 @@ import server from "./server.js"; import ws from "./ws.js"; import utils from "./utils.js"; import appContext from "../components/app_context.js"; +import { t } from "./i18n.js"; export async function uploadFiles(entityType, parentNoteId, files, options) { if (!['notes', 'attachments'].includes(entityType)) { @@ -47,7 +48,7 @@ export async function uploadFiles(entityType, parentNoteId, files, options) { function makeToast(id, message) { return { id: id, - title: "Import status", + title: t("import.import-status"), message: message, icon: "plus" }; @@ -62,9 +63,9 @@ ws.subscribeToMessages(async message => { toastService.closePersistent(message.taskId); toastService.showError(message.message); } else if (message.type === 'taskProgressCount') { - toastService.showPersistent(makeToast(message.taskId, `Import in progress: ${message.progressCount}`)); + toastService.showPersistent(makeToast(message.taskId, t("import.in-progress", { progress: message.progressCount }))); } else if (message.type === 'taskSucceeded') { - const toast = makeToast(message.taskId, "Import finished successfully."); + const toast = makeToast(message.taskId, t("import.successful")); toast.closeAfter = 5000; toastService.showPersistent(toast); @@ -84,9 +85,9 @@ ws.subscribeToMessages(async message => { toastService.closePersistent(message.taskId); toastService.showError(message.message); } else if (message.type === 'taskProgressCount') { - toastService.showPersistent(makeToast(message.taskId, `Import in progress: ${message.progressCount}`)); + toastService.showPersistent(makeToast(message.taskId, t("import.in-progress", { progress: message.progressCount }))); } else if (message.type === 'taskSucceeded') { - const toast = makeToast(message.taskId, "Import finished successfully."); + const toast = makeToast(message.taskId, t("import.successful")); toast.closeAfter = 5000; toastService.showPersistent(toast); diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json index 2e578dcd2..2d0fdf7af 100644 --- a/src/public/translations/en/translation.json +++ b/src/public/translations/en/translation.json @@ -182,7 +182,10 @@ "placeholder": "Enter HTML tags, one per line", "help": "Enter HTML tags to preserve during import. Some tags (like 'script') are always removed for security.", "reset_button": "Reset to Default List" - } + }, + "import-status": "Import status", + "in-progress": "Import in progress: {{progress}}", + "successful": "Import finished successfully." }, "include_note": { "dialog_title": "Include note", diff --git a/src/public/translations/ro/translation.json b/src/public/translations/ro/translation.json index 4306a3427..71548b2ce 100644 --- a/src/public/translations/ro/translation.json +++ b/src/public/translations/ro/translation.json @@ -692,7 +692,10 @@ "shrinkImages": "Micșorare imagini", "shrinkImagesTooltip": "

Dacă bifați această opțiune, Trilium va încerca să micșoreze imaginea importată prin scalarea și importarea ei, aspect ce poate afecta calitatea aparentă a imaginii. Dacă nu este bifat, imaginile vor fi importate fără nicio modificare.

Acest lucru nu se aplică la importuri de tip .zip cu metainformații deoarece se asumă că aceste fișiere sunt deja optimizate.

", "textImportedAsText": "Importă HTML, Markdown și TXT ca notițe de tip text dacă este neclar din metainformații", - "failed": "Eroare la importare: {{message}}." + "failed": "Eroare la importare: {{message}}.", + "import-status": "Starea importului", + "in-progress": "Import în curs: {{progress}}", + "successful": "Import finalizat cu succes." }, "include_archived_notes": { "include_archived_notes": "Include notițele arhivate"