fix(desktop): translate cut, copy, paste and select all in the right-click menu (#62252)

This commit is contained in:
DS
2026-11-06 20:39:26 -05:00
committed by GitHub
Unverified
parent 21ec64ac9f
commit 23f96c6efa
@@ -7,6 +7,7 @@ import { getUserShell, loadShellEnv } from "../service/shell-env"
import { registerRendererProtocol, setDockIcon, setProtocolReporter } from "../windows"
import { scoped } from "../native/logging"
import { applySpellcheck, spellcheckMenuItems } from "../native/spellcheck"
import { nativeT } from "../native/translations"
// electron-context-menu attaches to every existing and future window, so it can load once the first
// window is up instead of holding up startup with its dependency tree.
@@ -16,6 +17,21 @@ export const installContextMenu = Effect.gen(function* () {
showSaveImageAs: true,
showLookUpSelection: false,
showSearchWithGoogle: false,
// Getters, because electron-context-menu reads the labels each time the menu opens.
labels: {
get cut() {
return nativeT("desktop.menu.cut")
},
get copy() {
return nativeT("desktop.menu.copy")
},
get paste() {
return nativeT("desktop.menu.paste")
},
get selectAll() {
return nativeT("desktop.menu.selectAll")
},
},
append: (_actions, params) => (params.isEditable ? spellcheckMenuItems() : []),
})
})