fix: electron context menu i18n

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-09-19 23:13:57 +08:00
parent f278377d10
commit 1a1d8ab5c1
7 changed files with 62 additions and 6 deletions
+17 -1
View File
@@ -55,9 +55,14 @@ export const initializeAppStage1 = () => {
registerMenuAndContextMenu()
}
let contextMenuDisposer: () => void
export const registerMenuAndContextMenu = () => {
registerAppMenu()
contextMenu({
if (contextMenuDisposer) {
contextMenuDisposer()
}
contextMenuDisposer = contextMenu({
showSaveImageAs: true,
showCopyLink: true,
showCopyImageAddress: true,
@@ -75,6 +80,17 @@ export const registerMenuAndContextMenu = () => {
copyVideoAddress: t("contextMenu.copyVideoAddress"),
saveVideoAs: t("contextMenu.saveVideoAs"),
inspect: t("contextMenu.inspect"),
copy: t("contextMenu.copy"),
cut: t("contextMenu.cut"),
paste: t("contextMenu.paste"),
saveImage: t("contextMenu.saveImage"),
saveVideo: t("contextMenu.saveVideo"),
selectAll: t("contextMenu.selectAll"),
services: t("contextMenu.services"),
searchWithGoogle: t("contextMenu.searchWithGoogle"),
learnSpelling: t("contextMenu.learnSpelling"),
lookUpSelection: t("contextMenu.lookUpSelection"),
saveLinkAs: t("contextMenu.saveLinkAs"),
},
prepend: (_defaultActions, params) => {
@@ -13,6 +13,7 @@ import { FEED_COLLECTION_LIST, ROUTE_ENTRY_PENDING, views } from "~/constants"
import { shortcuts } from "~/constants/shortcuts"
import { useRouteParams } from "~/hooks/biz/useRouteParams"
import { useIsOnline } from "~/hooks/common"
import { stopPropagation } from "~/lib/dom"
import { FeedViewType } from "~/lib/enum"
import { cn, getOS, isBizId } from "~/lib/utils"
import { useAIDailyReportModal } from "~/modules/ai/ai-daily/hooks"
@@ -85,7 +86,7 @@ export const EntryListHeader: FC<{
"translate-x-[6px]",
)}
onClick={(e) => e.stopPropagation()}
onClick={stopPropagation}
>
{views[view].wideMode && entryId && entryId !== ROUTE_ENTRY_PENDING && (
<>
+11
View File
@@ -1,13 +1,24 @@
{
"contextMenu.copy": "Copy",
"contextMenu.copyImage": "Copy Image",
"contextMenu.copyImageAddress": "Copy Image Address",
"contextMenu.copyLink": "Copy Link",
"contextMenu.copyVideoAddress": "Copy Video Address",
"contextMenu.cut": "Cut",
"contextMenu.inspect": "Inspect Element",
"contextMenu.learnSpelling": "Learn Spelling",
"contextMenu.lookUpSelection": "Look Up Selection",
"contextMenu.openImageInBrowser": "Open Image in Browser",
"contextMenu.openLinkInBrowser": "Open Link in Browser",
"contextMenu.paste": "Paste",
"contextMenu.saveImage": "Save Image",
"contextMenu.saveImageAs": "Save Image As...",
"contextMenu.saveLinkAs": "Save Link As...",
"contextMenu.saveVideo": "Save Video",
"contextMenu.saveVideoAs": "Save Video As...",
"contextMenu.searchWithGoogle": "Search with Google",
"contextMenu.selectAll": "Select All",
"contextMenu.services": "Services",
"menu.about": "About {{name}}",
"menu.actualSize": "Actual Size",
"menu.bringAllToFront": "Bring All to Front",
+12
View File
@@ -1,13 +1,25 @@
{
"contextMenu.copy": "复制",
"contextMenu.copyImage": "复制图片",
"contextMenu.copyImageAddress": "复制图片地址",
"contextMenu.copyLink": "复制链接",
"contextMenu.copyVideoAddress": "复制视频地址",
"contextMenu.cut": "剪切",
"contextMenu.inspect": "检查元素",
"contextMenu.learnSpelling": "学习拼写",
"contextMenu.lookUpSelection": "在词典中查找",
"contextMenu.openImageInBrowser": "在浏览器中打开图片",
"contextMenu.openLinkInBrowser": "在浏览器中打开链接",
"contextMenu.paste": "粘贴",
"contextMenu.pasteAndMatchStyle": "粘贴并匹配样式",
"contextMenu.saveImage": "保存图片",
"contextMenu.saveImageAs": "图片另存为...",
"contextMenu.saveLinkAs": "链接另存为...",
"contextMenu.saveVideo": "保存视频",
"contextMenu.saveVideoAs": "视频另存为...",
"contextMenu.searchWithGoogle": "在谷歌中搜索",
"contextMenu.selectAll": "全选",
"contextMenu.services": "服务",
"menu.about": "关于 {{name}}",
"menu.actualSize": "实际大小",
"menu.bringAllToFront": "全部置于顶层",
+2 -1
View File
@@ -109,7 +109,8 @@
"immer@10.1.1": "patches/immer@10.1.1.patch",
"@mozilla/readability@0.5.0": "patches/@mozilla__readability@0.5.0.patch",
"re-resizable": "patches/re-resizable@6.9.17.patch",
"hono": "patches/hono.patch"
"hono": "patches/hono.patch",
"electron-context-menu": "patches/electron-context-menu.patch"
},
"overrides": {
"is-core-module": "npm:@nolyfill/is-core-module@^1",
+12
View File
@@ -0,0 +1,12 @@
diff --git a/index.js b/index.js
index b10daea2fbcee2eaeed9c61103eb89d93d4ee50d..5392745cdcdead1fbb39c17c42f3ed15f4141e35 100644
--- a/index.js
+++ b/index.js
@@ -378,6 +378,7 @@ export default function contextMenu(options = {}) {
};
webContents(win).once('destroyed', disposable);
+ disposables.push(disposable);
};
const dispose = () => {
+6 -3
View File
@@ -12,6 +12,9 @@ patchedDependencies:
'@mozilla/readability@0.5.0':
hash: fgkvsbckled47trggkhdkimzbm
path: patches/@mozilla__readability@0.5.0.patch
electron-context-menu:
hash: c53at4t5fflixuwjz35hmcqdu4
path: patches/electron-context-menu.patch
hono:
hash: iej2g43ojhll5opwbnvyorjq4e
path: patches/hono.patch
@@ -262,7 +265,7 @@ importers:
version: 16.4.5
electron-context-menu:
specifier: 4.0.4
version: 4.0.4
version: 4.0.4(patch_hash=c53at4t5fflixuwjz35hmcqdu4)
electron-log:
specifier: 5.2.0
version: 5.2.0
@@ -852,7 +855,7 @@ importers:
version: 16.4.5
electron-context-menu:
specifier: 4.0.4
version: 4.0.4
version: 4.0.4(patch_hash=c53at4t5fflixuwjz35hmcqdu4)
electron-log:
specifier: 5.2.0
version: 5.2.0
@@ -13981,7 +13984,7 @@ snapshots:
- dmg-builder
- supports-color
electron-context-menu@4.0.4:
electron-context-menu@4.0.4(patch_hash=c53at4t5fflixuwjz35hmcqdu4):
dependencies:
cli-truncate: 4.0.0
electron-dl: 4.0.0