Skip to content

Build your personal knowledge base with Trilium Notes

feat(i18n): translate import toast messages

Elian Doran38b4b3953d01
diff --git a/src/public/app/services/import.js b/src/public/app/services/import.js
index 715380ed8d..6cc3aebe70 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 2e578dcd23..2d0fdf7aff 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 4306a3427a..71548b2ce3 100644
--- a/src/public/translations/ro/translation.json
+++ b/src/public/translations/ro/translation.json
@@ -692,7 +692,10 @@
"shrinkImages": "Micșorare imagini",
"shrinkImagesTooltip": "<p>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.</p><p>Acest lucru nu se aplică la importuri de tip <code>.zip</code> cu metainformații deoarece se asumă că aceste fișiere sunt deja optimizate.</p>",
"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"