11import { DOCS_URL } from "@codev/brand"
2+ import type { dict } from "./i18n/en"
23import type { UpdaterState } from "./updater"
34
5+ // Menu labels are dictionary keys, not text: this table is read by the macOS
6+ // native menu in the desktop main process and by the Windows/Linux titlebar
7+ // menu in the renderer, and both resolve it against the app dictionaries. A
8+ // literal here is a label that never translates.
9+ export type DesktopMenuLabelKey = keyof typeof dict
10+
411export type DesktopMenuPlatform = "macos" | "windows"
512
613export type DesktopMenuAction =
@@ -48,7 +55,7 @@ export type DesktopMenuRole =
4855
4956export type DesktopMenuItem = {
5057 type : "item"
51- label ?: string
58+ labelKey ?: DesktopMenuLabelKey
5259 command ?: string
5360 action ?: DesktopMenuAction
5461 role ?: DesktopMenuRole
@@ -67,7 +74,7 @@ export type DesktopMenuEntry = DesktopMenuItem | DesktopMenuSeparator
6774
6875export type DesktopMenu = {
6976 id : string
70- label : string
77+ labelKey : DesktopMenuLabelKey
7178 role ?: DesktopMenuRole
7279 items ?: DesktopMenuEntry [ ]
7380 platforms ?: DesktopMenuPlatform [ ]
@@ -76,17 +83,17 @@ export type DesktopMenu = {
7683export const DESKTOP_MENU : DesktopMenu [ ] = [
7784 {
7885 id : "app" ,
79- label : "CoDev " ,
86+ labelKey : "menu.app " ,
8087 platforms : [ "macos" ] ,
8188 items : [
8289 { type : "item" , role : "about" } ,
83- { type : "item" , label : "Check for Updates... " , action : "app.checkForUpdates" , enabled : "updater" } ,
84- { type : "item" , label : "Settings " , command : "settings.open" , accelerator : { macos : "Cmd+," } } ,
85- { type : "item" , label : "Log in/Configure " , command : "gateway.apiKey.new" } ,
86- { type : "item" , label : "Upload Session Logs " , action : "upload.sessions" } ,
87- { type : "item" , label : "Reload Webview " , action : "view.reload" } ,
88- { type : "item" , label : "Restart " , action : "app.relaunch" } ,
89- { type : "item" , label : "Export Logs... " , command : "logs.export" } ,
90+ { type : "item" , labelKey : "menu.checkForUpdates " , action : "app.checkForUpdates" , enabled : "updater" } ,
91+ { type : "item" , labelKey : "menu.settings " , command : "settings.open" , accelerator : { macos : "Cmd+," } } ,
92+ { type : "item" , labelKey : "menu.login " , command : "gateway.apiKey.new" } ,
93+ { type : "item" , labelKey : "menu.uploadSessionLogs " , action : "upload.sessions" } ,
94+ { type : "item" , labelKey : "menu.reloadWebview " , action : "view.reload" } ,
95+ { type : "item" , labelKey : "menu.restart " , action : "app.relaunch" } ,
96+ { type : "item" , labelKey : "menu.exportLogs " , command : "logs.export" } ,
9097 { type : "separator" } ,
9198 { type : "item" , role : "hide" } ,
9299 { type : "item" , role : "hideOthers" } ,
@@ -97,18 +104,18 @@ export const DESKTOP_MENU: DesktopMenu[] = [
97104 } ,
98105 {
99106 id : "file" ,
100- label : "File " ,
107+ labelKey : "menu.file " ,
101108 items : [
102109 {
103110 type : "item" ,
104- label : "New Session " ,
111+ labelKey : "menu.newSession " ,
105112 command : "session.new" ,
106113 accelerator : { macos : "Shift+Cmd+S" } ,
107114 } ,
108- { type : "item" , label : "Open Project... " , command : "project.open" , accelerator : { macos : "Cmd+O" } } ,
115+ { type : "item" , labelKey : "menu.openProject " , command : "project.open" , accelerator : { macos : "Cmd+O" } } ,
109116 {
110117 type : "item" ,
111- label : "Settings " ,
118+ labelKey : "menu.settings " ,
112119 command : "settings.open" ,
113120 accelerator : { windows : "Ctrl+," } ,
114121 platforms : [ "windows" ] ,
@@ -117,41 +124,41 @@ export const DESKTOP_MENU: DesktopMenu[] = [
117124 // Windows/Linux menu does not render — same split Settings itself uses.
118125 {
119126 type : "item" ,
120- label : "Log in/Configure " ,
127+ labelKey : "menu.login " ,
121128 command : "gateway.apiKey.new" ,
122129 platforms : [ "windows" ] ,
123130 } ,
124131 // macOS carries this in the app menu below its sign-in sibling.
125132 {
126133 type : "item" ,
127- label : "Upload Session Logs " ,
134+ labelKey : "menu.uploadSessionLogs " ,
128135 action : "upload.sessions" ,
129136 platforms : [ "windows" ] ,
130137 } ,
131138 {
132139 type : "item" ,
133- label : "New Window " ,
140+ labelKey : "menu.newWindow " ,
134141 action : "window.new" ,
135142 accelerator : { macos : "Cmd+Shift+N" , windows : "Ctrl+Shift+N" } ,
136143 } ,
137144 { type : "separator" } ,
138- { type : "item" , label : "Close Window " , action : "window.close" , role : "close" } ,
145+ { type : "item" , labelKey : "menu.closeWindow " , action : "window.close" , role : "close" } ,
139146 ] ,
140147 } ,
141148 {
142149 id : "edit" ,
143- label : "Edit " ,
150+ labelKey : "menu.edit " ,
144151 items : [
145- { type : "item" , label : "Undo " , action : "edit.undo" , role : "undo" , accelerator : { windows : "Ctrl+Z" } } ,
146- { type : "item" , label : "Redo " , action : "edit.redo" , role : "redo" , accelerator : { windows : "Ctrl+Y" } } ,
152+ { type : "item" , labelKey : "menu.undo " , action : "edit.undo" , role : "undo" , accelerator : { windows : "Ctrl+Z" } } ,
153+ { type : "item" , labelKey : "menu.redo " , action : "edit.redo" , role : "redo" , accelerator : { windows : "Ctrl+Y" } } ,
147154 { type : "separator" } ,
148- { type : "item" , label : "Cut " , action : "edit.cut" , role : "cut" , accelerator : { windows : "Ctrl+X" } } ,
149- { type : "item" , label : "Copy " , action : "edit.copy" , role : "copy" , accelerator : { windows : "Ctrl+C" } } ,
150- { type : "item" , label : "Paste " , action : "edit.paste" , role : "paste" , accelerator : { windows : "Ctrl+V" } } ,
151- { type : "item" , label : "Delete " , action : "edit.delete" } ,
155+ { type : "item" , labelKey : "menu.cut " , action : "edit.cut" , role : "cut" , accelerator : { windows : "Ctrl+X" } } ,
156+ { type : "item" , labelKey : "menu.copy " , action : "edit.copy" , role : "copy" , accelerator : { windows : "Ctrl+C" } } ,
157+ { type : "item" , labelKey : "menu.paste " , action : "edit.paste" , role : "paste" , accelerator : { windows : "Ctrl+V" } } ,
158+ { type : "item" , labelKey : "menu.delete " , action : "edit.delete" } ,
152159 {
153160 type : "item" ,
154- label : "Select All " ,
161+ labelKey : "menu.selectAll " ,
155162 action : "edit.selectAll" ,
156163 role : "selectAll" ,
157164 accelerator : { windows : "Ctrl+A" } ,
@@ -160,78 +167,95 @@ export const DESKTOP_MENU: DesktopMenu[] = [
160167 } ,
161168 {
162169 id : "view" ,
163- label : "View " ,
170+ labelKey : "menu.view " ,
164171 items : [
165- { type : "item" , label : "Toggle Sidebar " , command : "sidebar.toggle" } ,
166- { type : "item" , label : "Toggle Terminal " , command : "terminal.toggle" , accelerator : { macos : "Ctrl+`" } } ,
167- { type : "item" , label : "Toggle File Tree " , command : "fileTree.toggle" } ,
172+ { type : "item" , labelKey : "menu.toggleSidebar " , command : "sidebar.toggle" } ,
173+ { type : "item" , labelKey : "menu.toggleTerminal " , command : "terminal.toggle" , accelerator : { macos : "Ctrl+`" } } ,
174+ { type : "item" , labelKey : "menu.toggleFileTree " , command : "fileTree.toggle" } ,
168175 { type : "separator" } ,
169- { type : "item" , label : "Reload " , action : "view.reload" , role : "reload" } ,
170- { type : "item" , label : "Toggle Developer Tools " , action : "view.toggleDevTools" , role : "toggleDevTools" } ,
176+ { type : "item" , labelKey : "menu.reload " , action : "view.reload" , role : "reload" } ,
177+ { type : "item" , labelKey : "menu.toggleDevTools " , action : "view.toggleDevTools" , role : "toggleDevTools" } ,
171178 { type : "separator" } ,
172179 {
173180 type : "item" ,
174- label : "Actual Size " ,
181+ labelKey : "menu.actualSize " ,
175182 action : "view.resetZoom" ,
176183 role : "resetZoom" ,
177184 accelerator : { windows : "Ctrl+0" } ,
178185 } ,
179- { type : "item" , label : "Zoom In" , action : "view.zoomIn" , role : "zoomIn" , accelerator : { windows : "Ctrl++" } } ,
180- { type : "item" , label : "Zoom Out" , action : "view.zoomOut" , role : "zoomOut" , accelerator : { windows : "Ctrl+-" } } ,
186+ {
187+ type : "item" ,
188+ labelKey : "menu.zoomIn" ,
189+ action : "view.zoomIn" ,
190+ role : "zoomIn" ,
191+ accelerator : { windows : "Ctrl++" } ,
192+ } ,
193+ {
194+ type : "item" ,
195+ labelKey : "menu.zoomOut" ,
196+ action : "view.zoomOut" ,
197+ role : "zoomOut" ,
198+ accelerator : { windows : "Ctrl+-" } ,
199+ } ,
181200 { type : "separator" } ,
182- { type : "item" , label : "Toggle Full Screen " , action : "view.toggleFullscreen" , role : "togglefullscreen" } ,
201+ { type : "item" , labelKey : "menu.toggleFullScreen " , action : "view.toggleFullscreen" , role : "togglefullscreen" } ,
183202 ] ,
184203 } ,
185204 {
186205 id : "go" ,
187- label : "Go " ,
206+ labelKey : "menu.go " ,
188207 items : [
189- { type : "item" , label : "Back " , command : "common.goBack" , accelerator : { macos : "Cmd+[" } } ,
190- { type : "item" , label : "Forward " , command : "common.goForward" , accelerator : { macos : "Cmd+]" } } ,
208+ { type : "item" , labelKey : "menu.back " , command : "common.goBack" , accelerator : { macos : "Cmd+[" } } ,
209+ { type : "item" , labelKey : "menu.forward " , command : "common.goForward" , accelerator : { macos : "Cmd+]" } } ,
191210 { type : "separator" } ,
192- { type : "item" , label : "Previous Session" , command : "session.previous" , accelerator : { macos : "Option+Up" } } ,
193- { type : "item" , label : "Next Session" , command : "session.next" , accelerator : { macos : "Option+Down" } } ,
211+ {
212+ type : "item" ,
213+ labelKey : "menu.previousSession" ,
214+ command : "session.previous" ,
215+ accelerator : { macos : "Option+Up" } ,
216+ } ,
217+ { type : "item" , labelKey : "menu.nextSession" , command : "session.next" , accelerator : { macos : "Option+Down" } } ,
194218 { type : "separator" } ,
195219 {
196220 type : "item" ,
197- label : "Previous Project " ,
221+ labelKey : "menu.previousProject " ,
198222 command : "project.previous" ,
199223 accelerator : { macos : "Cmd+Option+Up" } ,
200224 } ,
201225 {
202226 type : "item" ,
203- label : "Next Project " ,
227+ labelKey : "menu.nextProject " ,
204228 command : "project.next" ,
205229 accelerator : { macos : "Cmd+Option+Down" } ,
206230 } ,
207231 ] ,
208232 } ,
209233 {
210234 id : "window" ,
211- label : "Window " ,
235+ labelKey : "menu.window " ,
212236 role : "windowMenu" ,
213237 items : [
214- { type : "item" , label : "Minimize " , action : "window.minimize" } ,
215- { type : "item" , label : "Maximize " , action : "window.toggleMaximize" } ,
238+ { type : "item" , labelKey : "menu.minimize " , action : "window.minimize" } ,
239+ { type : "item" , labelKey : "menu.maximize " , action : "window.toggleMaximize" } ,
216240 { type : "separator" } ,
217- { type : "item" , label : "Close Window " , action : "window.close" } ,
241+ { type : "item" , labelKey : "menu.closeWindow " , action : "window.close" } ,
218242 ] ,
219243 } ,
220244 {
221245 id : "help" ,
222- label : "Help " ,
246+ labelKey : "menu.help " ,
223247 items : [
224- { type : "item" , label : "CoDev Documentation " , href : DOCS_URL } ,
225- { type : "item" , label : "Export Logs... " , command : "logs.export" } ,
248+ { type : "item" , labelKey : "menu.documentation " , href : DOCS_URL } ,
249+ { type : "item" , labelKey : "menu.exportLogs " , command : "logs.export" } ,
226250 { type : "separator" } ,
227251 {
228252 type : "item" ,
229- label : "Share Feedback " ,
253+ labelKey : "menu.shareFeedback " ,
230254 href : "https://github.com/quickbeard/codev-code/issues/new?template=feature-request.yml" ,
231255 } ,
232256 {
233257 type : "item" ,
234- label : "Report a Bug " ,
258+ labelKey : "menu.reportBug " ,
235259 href : "https://github.com/quickbeard/codev-code/issues/new?template=bug-report.yml" ,
236260 } ,
237261 // macOS has this in the app menu, which the Windows/Linux menu does not
@@ -240,7 +264,7 @@ export const DESKTOP_MENU: DesktopMenu[] = [
240264 { type : "separator" , platforms : [ "windows" ] } ,
241265 {
242266 type : "item" ,
243- label : "Check for Updates... " ,
267+ labelKey : "menu.checkForUpdates " ,
244268 action : "app.checkForUpdates" ,
245269 enabled : "updater" ,
246270 platforms : [ "windows" ] ,
0 commit comments