feat(i18n): translate import toast messages

This commit is contained in:
Elian Doran 2024-11-28 23:31:06 +02:00
parent b3b8e60192
commit 38b4b3953d
No known key found for this signature in database
3 changed files with 14 additions and 7 deletions

View File

@ -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);

View File

@ -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",

View File

@ -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"