Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(client): translate Electron context menu
Elian Doran2ffd0de736c5
diff --git a/src/public/app/menus/electron_context_menu.js b/src/public/app/menus/electron_context_menu.jsindex 7c2e96fbd0..62dc36191b 100644--- a/src/public/app/menus/electron_context_menu.js+++ b/src/public/app/menus/electron_context_menu.js@@ -2,6 +2,7 @@ import utils from "../services/utils.js";import options from "../services/options.js";import zoomService from "../components/zoom.js";import contextMenu from "./context_menu.js";+import { t } from "../services/i18n.js";function setupContextMenu() {const electron = utils.dynamicRequire('electron');@@ -28,7 +29,7 @@ function setupContextMenu() {}items.push({- title: `Add "${params.misspelledWord}" to dictionary`,+ title: t("electron_context_menu.add-term-to-dictionary", { term: params.misspelledWord }),uiIcon: "bx bx-plus",handler: () => webContents.session.addWordToSpellCheckerDictionary(params.misspelledWord)});@@ -39,7 +40,7 @@ function setupContextMenu() {if (params.isEditable) {items.push({enabled: editFlags.canCut && hasText,- title: `Cut`,+ title: t("electron_context_menu.cut"),shortcut: `${platformModifier}+X`,uiIcon: "bx bx-cut",handler: () => webContents.cut()@@ -49,7 +50,7 @@ function setupContextMenu() {if (params.isEditable || hasText) {items.push({enabled: editFlags.canCopy && hasText,- title: `Copy`,+ title: t("electron_context_menu.copy"),shortcut: `${platformModifier}+C`,uiIcon: "bx bx-copy",handler: () => webContents.copy()@@ -58,7 +59,7 @@ function setupContextMenu() {if (!["", "javascript:", "about:blank#blocked"].includes(params.linkURL) && params.mediaType === 'none') {items.push({- title: `Copy link`,+ title: t("electron_context_menu.copy-link"),uiIcon: "bx bx-copy",handler: () => {electron.clipboard.write({@@ -72,7 +73,7 @@ function setupContextMenu() {if (params.isEditable) {items.push({enabled: editFlags.canPaste,- title: `Paste`,+ title: t("electron_context_menu.paste"),shortcut: `${platformModifier}+V`,uiIcon: "bx bx-paste",handler: () => webContents.paste()@@ -82,7 +83,7 @@ function setupContextMenu() {if (params.isEditable) {items.push({enabled: editFlags.canPaste,- title: `Paste as plain text`,+ title: t("electron_context_menu.paste-as-plain-text"),shortcut: `${platformModifier}+Shift+V`,uiIcon: "bx bx-paste",handler: () => webContents.pasteAndMatchStyle()@@ -114,7 +115,7 @@ function setupContextMenu() {items.push({enabled: editFlags.canPaste,- title: `Search for "${shortenedSelection}" with ${searchEngineName}`,+ title: t("electron_context_menu.search_online", { term: shortenedSelection, searchEngine: searchEngineName }),uiIcon: "bx bx-search-alt",handler: () => electron.shell.openExternal(searchUrl)});diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.jsonindex 0762f0028c..de23771249 100644--- a/src/public/translations/en/translation.json+++ b/src/public/translations/en/translation.json@@ -1537,5 +1537,14 @@"description": "editing tools appear in the \"Formatting\" ribbon tab."}}+ },+ "electron_context_menu": {+ "add-term-to-dictionary": "Add \"{{term}}\" to dictionary",+ "cut": "Cut",+ "copy": "Copy",+ "copy-link": "Copy link",+ "paste": "Paste",+ "paste-as-plain-text": "Paste as plain text",+ "search_online": "Search for \"{{term}}\" with {{searchEngine}}"}}