mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 11:02:28 +08:00
feat(client): translate Electron context menu
This commit is contained in:
parent
ea8e98b8ef
commit
2ffd0de736
@ -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)
|
||||
});
|
||||
|
@ -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}}"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user