From c33154d12832485ecfd8d5be153e0937078d1e5b Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 8 Sep 2024 12:32:22 +0300 Subject: [PATCH] i18n: Translate tree context menu --- src/public/app/menus/tree_context_menu.js | 53 +++++++++++---------- src/public/translations/en/translation.json | 28 +++++++++++ src/public/translations/ro/translation.json | 28 +++++++++++ 3 files changed, 83 insertions(+), 26 deletions(-) diff --git a/src/public/app/menus/tree_context_menu.js b/src/public/app/menus/tree_context_menu.js index e3e19dc93..684b31c99 100644 --- a/src/public/app/menus/tree_context_menu.js +++ b/src/public/app/menus/tree_context_menu.js @@ -8,6 +8,7 @@ import noteTypesService from "../services/note_types.js"; import server from "../services/server.js"; import toastService from "../services/toast.js"; import dialogService from "../services/dialog.js"; +import { t } from "../services/i18n.js"; export default class TreeContextMenu { /** @@ -48,55 +49,55 @@ export default class TreeContextMenu { const insertNoteAfterEnabled = isNotRoot && !isHoisted && parentNotSearch; return [ - { title: 'Open in a new tab Ctrl+Click', command: "openInTab", uiIcon: "bx bx-empty", enabled: noSelectedNotes }, - { title: 'Open in a new split', command: "openNoteInSplit", uiIcon: "bx bx-dock-right", enabled: noSelectedNotes }, - { title: 'Insert note after ', command: "insertNoteAfter", uiIcon: "bx bx-plus", + { title: `${t("tree-context-menu.open-in-a-new-tab")} Ctrl+Click`, command: "openInTab", uiIcon: "bx bx-empty", enabled: noSelectedNotes }, + { title: t("tree-context-menu.open-in-a-new-split"), command: "openNoteInSplit", uiIcon: "bx bx-dock-right", enabled: noSelectedNotes }, + { title: `${t("tree-context-menu.insert-note-after")} `, command: "insertNoteAfter", uiIcon: "bx bx-plus", items: insertNoteAfterEnabled ? await noteTypesService.getNoteTypeItems("insertNoteAfter") : null, enabled: insertNoteAfterEnabled && noSelectedNotes && notOptions }, - { title: 'Insert child note ', command: "insertChildNote", uiIcon: "bx bx-plus", + { title: `${t("tree-context-menu.insert-child-note")} `, command: "insertChildNote", uiIcon: "bx bx-plus", items: notSearch ? await noteTypesService.getNoteTypeItems("insertChildNote") : null, enabled: notSearch && noSelectedNotes && notOptions }, - { title: 'Delete ', command: "deleteNotes", uiIcon: "bx bx-trash", + { title: `${t("tree-context-menu.delete")} `, command: "deleteNotes", uiIcon: "bx bx-trash", enabled: isNotRoot && !isHoisted && parentNotSearch && notOptions }, { title: "----" }, - { title: 'Search in subtree ', command: "searchInSubtree", uiIcon: "bx bx-search", + { title: `${t("tree-context-menu.search-in-subtree")} `, command: "searchInSubtree", uiIcon: "bx bx-search", enabled: notSearch && noSelectedNotes }, isHoisted ? null : { title: 'Hoist note ', command: "toggleNoteHoisting", uiIcon: "bx bx-empty", enabled: noSelectedNotes && notSearch }, !isHoisted || !isNotRoot ? null : { title: 'Unhoist note ', command: "toggleNoteHoisting", uiIcon: "bx bx-door-open" }, - { title: 'Edit branch prefix ', command: "editBranchPrefix", uiIcon: "bx bx-empty", + { title: `${t("tree-context-menu.edit-branch-prefix")} `, command: "editBranchPrefix", uiIcon: "bx bx-empty", enabled: isNotRoot && parentNotSearch && noSelectedNotes && notOptions }, - { title: "Advanced", uiIcon: "bx bx-empty", enabled: true, items: [ - { title: 'Expand subtree ', command: "expandSubtree", uiIcon: "bx bx-expand", enabled: noSelectedNotes }, - { title: 'Collapse subtree ', command: "collapseSubtree", uiIcon: "bx bx-collapse", enabled: noSelectedNotes }, - { title: 'Sort by ... ', command: "sortChildNotes", uiIcon: "bx bx-empty", enabled: noSelectedNotes && notSearch }, - { title: 'Recent changes in subtree', command: "recentChangesInSubtree", uiIcon: "bx bx-history", enabled: noSelectedNotes && notOptions }, - { title: 'Convert to attachment', command: "convertNoteToAttachment", uiIcon: "bx bx-empty", enabled: isNotRoot && !isHoisted && notOptions }, - { title: 'Copy note path to clipboard', command: "copyNotePathToClipboard", uiIcon: "bx bx-empty", enabled: true } + { title: t("tree-context-menu.advanced"), uiIcon: "bx bx-empty", enabled: true, items: [ + { title: `${t("tree-context-menu.expand-subtree")} `, command: "expandSubtree", uiIcon: "bx bx-expand", enabled: noSelectedNotes }, + { title: `${t("tree-context-menu.collapse-subtree")} `, command: "collapseSubtree", uiIcon: "bx bx-collapse", enabled: noSelectedNotes }, + { title: `${t("tree-context-menu.sort-by")} `, command: "sortChildNotes", uiIcon: "bx bx-empty", enabled: noSelectedNotes && notSearch }, + { title: t("tree-context-menu.recent-changes-in-subtree"), command: "recentChangesInSubtree", uiIcon: "bx bx-history", enabled: noSelectedNotes && notOptions }, + { title: t("tree-context-menu.convert-to-attachment"), command: "convertNoteToAttachment", uiIcon: "bx bx-empty", enabled: isNotRoot && !isHoisted && notOptions }, + { title: t("tree-context-menu.copy-note-path-to-clipboard"), command: "copyNotePathToClipboard", uiIcon: "bx bx-empty", enabled: true } ] }, { title: "----" }, - { title: "Protect subtree", command: "protectSubtree", uiIcon: "bx bx-check-shield", enabled: noSelectedNotes }, - { title: "Unprotect subtree", command: "unprotectSubtree", uiIcon: "bx bx-shield", enabled: noSelectedNotes }, + { title: t("tree-context-menu.protect-subtree"), command: "protectSubtree", uiIcon: "bx bx-check-shield", enabled: noSelectedNotes }, + { title: t("tree-context-menu.unprotect-subtree"), command: "unprotectSubtree", uiIcon: "bx bx-shield", enabled: noSelectedNotes }, { title: "----" }, - { title: 'Copy / clone ', command: "copyNotesToClipboard", uiIcon: "bx bx-copy", + { title: `${t("tree-context-menu.copy-clone")} `, command: "copyNotesToClipboard", uiIcon: "bx bx-copy", enabled: isNotRoot && !isHoisted }, - { title: 'Clone to ... ', command: "cloneNotesTo", uiIcon: "bx bx-empty", + { title: `${t("tree-context-menu.clone-to")} `, command: "cloneNotesTo", uiIcon: "bx bx-empty", enabled: isNotRoot && !isHoisted }, - { title: 'Cut ', command: "cutNotesToClipboard", uiIcon: "bx bx-cut", + { title: `${t("tree-context-menu.cut")} `, command: "cutNotesToClipboard", uiIcon: "bx bx-cut", enabled: isNotRoot && !isHoisted && parentNotSearch }, - { title: 'Move to ... ', command: "moveNotesTo", uiIcon: "bx bx-empty", + { title: `${t("tree-context-menu.move-to")} `, command: "moveNotesTo", uiIcon: "bx bx-empty", enabled: isNotRoot && !isHoisted && parentNotSearch }, - { title: 'Paste into ', command: "pasteNotesFromClipboard", uiIcon: "bx bx-paste", + { title: `${t("tree-context-menu.paste-into")} `, command: "pasteNotesFromClipboard", uiIcon: "bx bx-paste", enabled: !clipboard.isClipboardEmpty() && notSearch && noSelectedNotes }, - { title: 'Paste after', command: "pasteNotesAfterFromClipboard", uiIcon: "bx bx-paste", + { title: t("tree-context-menu.paste-after"), command: "pasteNotesAfterFromClipboard", uiIcon: "bx bx-paste", enabled: !clipboard.isClipboardEmpty() && isNotRoot && !isHoisted && parentNotSearch && noSelectedNotes }, - { title: `Duplicate subtree `, command: "duplicateSubtree", uiIcon: "bx bx-empty", + { title: `${t("tree-context-menu.duplicate-subtree")} `, command: "duplicateSubtree", uiIcon: "bx bx-empty", enabled: parentNotSearch && isNotRoot && !isHoisted && notOptions }, { title: "----" }, - { title: "Export", command: "exportNote", uiIcon: "bx bx-empty", + { title: t("tree-context-menu.export"), command: "exportNote", uiIcon: "bx bx-empty", enabled: notSearch && noSelectedNotes && notOptions }, - { title: "Import into note", command: "importIntoNote", uiIcon: "bx bx-empty", + { title: t("tree-context-menu.import-into-note"), command: "importIntoNote", uiIcon: "bx bx-empty", enabled: notSearch && noSelectedNotes && notOptions }, - { title: "Apply bulk actions", command: "openBulkActionsDialog", uiIcon: "bx bx-list-plus", + { title: t("tree-context-menu.apply-bulk-actions"), command: "openBulkActionsDialog", uiIcon: "bx bx-list-plus", enabled: true } ].filter(row => row !== null); } diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json index cc7fd98ba..9e08beac4 100644 --- a/src/public/translations/en/translation.json +++ b/src/public/translations/en/translation.json @@ -1248,5 +1248,33 @@ "note-map": { "button-link-map": "Link Map", "button-tree-map": "Tree map" + }, + "tree-context-menu": { + "open-in-a-new-tab": "Open in a new tab", + "open-in-a-new-split": "Open in a new split", + "insert-note-after": "Insert note after", + "insert-child-note": "Insert child note", + "delete": "Delete", + "search-in-subtree": "Search in subtree", + "edit-branch-prefix": "Edit branch prefix", + "advanced": "Advanced", + "expand-subtree": "Expand subtree", + "collapse-subtree": "Collapse subtree", + "sort-by": "Sort by...", + "recent-changes-in-subtree": "Recent changes in subtree", + "convert-to-attachment": "Convert to attachment", + "copy-note-path-to-clipboard": "Copy note path to clipboard", + "protect-subtree": "Protect subtree", + "unprotect-subtree": "Unprotect subtree", + "copy-clone": "Copy / clone", + "clone-to": "Clone to...", + "cut": "Cut", + "move-to": "Move to...", + "paste-into": "Paste into", + "paste-after": "Paste after", + "duplicate-subtree": "Duplicate subtree", + "export": "Export", + "import-into-note": "Import into note", + "apply-bulk-actions": "Apply bulk actions" } } diff --git a/src/public/translations/ro/translation.json b/src/public/translations/ro/translation.json index 07e450c3a..7bc5ccfb6 100644 --- a/src/public/translations/ro/translation.json +++ b/src/public/translations/ro/translation.json @@ -1248,5 +1248,33 @@ "note-map": { "button-link-map": "Harta legăturilor", "button-tree-map": "Harta ierarhiei" + }, + "tree-context-menu": { + "advanced": "Opțiuni avansate", + "apply-bulk-actions": "Aplică acțiuni în masă", + "clone-to": "Clonare în...", + "collapse-subtree": "Minimizează subnotițele", + "convert-to-attachment": "Convertește în atașament", + "copy-clone": "Copiază/clonează", + "copy-note-path-to-clipboard": "Copiază calea notiței în clipboard", + "cut": "Decupează", + "delete": "Șterge", + "duplicate-subtree": "Dublifică ierarhia", + "edit-branch-prefix": "Editează prefixul ramurii", + "expand-subtree": "Expandează subnotițele", + "export": "Exportă", + "import-into-note": "Importă în notiță", + "insert-child-note": "Inserează subnotiță", + "insert-note-after": "Inserează după notiță", + "move-to": "Mutare la...", + "open-in-a-new-split": "Deschide în lateral", + "open-in-a-new-tab": "Deschide în tab nou", + "paste-after": "Lipește după notiță", + "paste-into": "Lipește în notiță", + "protect-subtree": "Protejează ierarhia", + "recent-changes-in-subtree": "Schimbări recente în ierarhie", + "search-in-subtree": "Caută în ierarhie", + "sort-by": "Ordonare după...", + "unprotect-subtree": "Deprotejează ierarhia" } }