From b5ee90a1d2664bf7f36f3f28b16918336822dae3 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 20 Oct 2024 11:45:53 +0300 Subject: [PATCH] i18n: Translate delete/restore branch --- src/public/app/services/branches.js | 11 ++++++----- src/public/translations/en/translation.json | 7 ++++++- src/public/translations/ro/translation.json | 7 ++++++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/public/app/services/branches.js b/src/public/app/services/branches.js index 1f70556ed..803c59147 100644 --- a/src/public/app/services/branches.js +++ b/src/public/app/services/branches.js @@ -5,6 +5,7 @@ import froca from "./froca.js"; import hoistedNoteService from "./hoisted_note.js"; import ws from "./ws.js"; import appContext from "../components/app_context.js"; +import { t } from './i18n.js'; async function moveBeforeBranch(branchIdsToMove, beforeBranchId) { branchIdsToMove = filterRootNote(branchIdsToMove); @@ -192,7 +193,7 @@ function filterRootNote(branchIds) { function makeToast(id, message) { return { id: id, - title: "Delete status", + title: t("branches.delete-status"), message: message, icon: "trash" }; @@ -207,9 +208,9 @@ ws.subscribeToMessages(async message => { toastService.closePersistent(message.taskId); toastService.showError(message.message); } else if (message.type === 'taskProgressCount') { - toastService.showPersistent(makeToast(message.taskId, `Delete notes in progress: ${message.progressCount}`)); + toastService.showPersistent(makeToast(message.taskId, t("branches.delete-notes-in-progress", { count: message.progressCount }))); } else if (message.type === 'taskSucceeded') { - const toast = makeToast(message.taskId, "Delete finished successfully."); + const toast = makeToast(message.taskId, t("branches.delete-finished-successfully")); toast.closeAfter = 5000; toastService.showPersistent(toast); @@ -225,9 +226,9 @@ ws.subscribeToMessages(async message => { toastService.closePersistent(message.taskId); toastService.showError(message.message); } else if (message.type === 'taskProgressCount') { - toastService.showPersistent(makeToast(message.taskId, `Undeleting notes in progress: ${message.progressCount}`)); + toastService.showPersistent(makeToast(message.taskId, t("branches.undeleting-notes-in-progress", { count: message.progressCount }))); } else if (message.type === 'taskSucceeded') { - const toast = makeToast(message.taskId, "Undeleting notes finished successfully."); + const toast = makeToast(message.taskId, t("branches.undeleting-notes-finished-successfully")); toast.closeAfter = 5000; toastService.showPersistent(toast); diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json index 2ca89c155..35fb226e5 100644 --- a/src/public/translations/en/translation.json +++ b/src/public/translations/en/translation.json @@ -1461,7 +1461,12 @@ "sql-error": "Error occurred while executing SQL query: {{message}}" }, "branches": { - "cannot-move-notes-here": "Cannot move notes here." + "cannot-move-notes-here": "Cannot move notes here.", + "delete-status": "Delete status", + "delete-notes-in-progress": "Delete notes in progress: {{count}}", + "delete-finished-successfully": "Delete finished successfully.", + "undeleting-notes-in-progress": "Undeleting notes in progress: {{count}}", + "undeleting-notes-finished-successfully": "Undeleting notes finished successfully." }, "frontend_script_api": { "async_warning": "You're passing an async function to `api.runOnBackend()` which will likely not work as you intended.\\nEither make the function synchronous (by removing `async` keyword), or use `api.runAsyncOnBackendWithManualTransactionHandling()`.", diff --git a/src/public/translations/ro/translation.json b/src/public/translations/ro/translation.json index dd4052b80..a6bed6d62 100644 --- a/src/public/translations/ro/translation.json +++ b/src/public/translations/ro/translation.json @@ -1461,7 +1461,12 @@ "duplicated": "Notița „{{title}}” a fost dublificată." }, "branches": { - "cannot-move-notes-here": "Nu se pot muta notițe aici." + "cannot-move-notes-here": "Nu se pot muta notițe aici.", + "delete-finished-successfully": "Ștergerea a avut succes.", + "delete-notes-in-progress": "Ștergere în curs: {{count}}", + "delete-status": "Starea ștergerii", + "undeleting-notes-finished-successfully": "Restaurarea notițelor a avut succes.", + "undeleting-notes-in-progress": "Restaurare notițe în curs: {{count}}" }, "frontend_script_api": { "async_warning": "Ați trimis o funcție asincronă metodei `api.runOnBackend()` și este posibil să nu se comporte așa cum vă așteptați.\\nFie faceți metoda sincronă (prin ștergerea cuvântului-cheie `async`), sau folosiți `api.runAsyncOnBackendWithManualTransactionHandling()`.",