Add labels to role-only menu item to have consistent languages in menu

This commit is contained in:
Germain Souquet 2021-04-26 14:14:35 +01:00
parent e950303966
commit 00ba42186b
2 changed files with 119 additions and 31 deletions

View File

@ -5,14 +5,34 @@
"Show/Hide": "Show/Hide", "Show/Hide": "Show/Hide",
"Quit": "Quit", "Quit": "Quit",
"Edit": "Edit", "Edit": "Edit",
"Undo": "Undo",
"Redo": "Redo",
"Cut": "Cut",
"Copy": "Copy",
"Paste": "Paste",
"Paste and Match Style": "Paste and Match Style",
"Delete": "Delete",
"Select All": "Select All",
"View": "View", "View": "View",
"Actual Size": "Actual Size",
"Zoom In": "Zoom In",
"Zoom Out": "Zoom Out",
"Preferences": "Preferences", "Preferences": "Preferences",
"Toggle Full Screen": "Toggle Full Screen",
"Toggle Developer Tools": "Toggle Developer Tools",
"Window": "Window", "Window": "Window",
"Minimize": "Minimize",
"Close": "Close",
"Help": "Help", "Help": "Help",
"Element Help": "Element Help", "Element Help": "Element Help",
"About": "About",
"Services": "Services",
"Hide": "Hide",
"Hide Others": "Hide Others",
"Unhide": "Unhide",
"Speech": "Speech", "Speech": "Speech",
"Close": "Close", "Start Speaking": "Start Speaking",
"Minimize": "Minimize", "Stop Speaking": "Stop Speaking",
"Zoom": "Zoom", "Zoom": "Zoom",
"Bring All to Front": "Bring All to Front", "Bring All to Front": "Bring All to Front",
"File": "File", "File": "File",
@ -22,9 +42,5 @@
"Save image as...": "Save image as...", "Save image as...": "Save image as...",
"Failed to save image": "Failed to save image", "Failed to save image": "Failed to save image",
"The image failed to save": "The image failed to save", "The image failed to save": "The image failed to save",
"Add to dictionary": "Add to dictionary", "Add to dictionary": "Add to dictionary"
"Cut": "Cut",
"Copy": "Copy",
"Paste": "Paste",
"Select All": "Select All"
} }

View File

@ -24,15 +24,39 @@ function buildMenuTemplate() {
label: _td('Edit'), label: _td('Edit'),
accelerator: 'e', accelerator: 'e',
submenu: [ submenu: [
{ role: 'undo' }, {
{ role: 'redo' }, role: 'undo',
label: _td('Undo'),
},
{
role: 'redo',
label: _td('Redo'),
},
{ type: 'separator' }, { type: 'separator' },
{ role: 'cut' }, {
{ role: 'copy' }, role: 'cut',
{ role: 'paste' }, label: _td('Cut'),
{ role: 'pasteandmatchstyle' }, },
{ role: 'delete' }, {
{ role: 'selectall' }, role: 'copy',
label: _td('Copy'),
},
{
role: 'paste',
label: _td('Paste'),
},
{
role: 'pasteandmatchstyle',
label: _td('Paste and Match Style'),
},
{
role: 'delete',
label: _td('Delete'),
},
{
role: 'selectall',
label: _td('Select All'),
},
], ],
}, },
{ {
@ -40,17 +64,33 @@ function buildMenuTemplate() {
accelerator: 'V', accelerator: 'V',
submenu: [ submenu: [
{ type: 'separator' }, { type: 'separator' },
{ role: 'resetzoom' }, {
{ role: 'zoomin', accelerator: 'CommandOrControl+=' }, role: 'resetzoom',
{ role: 'zoomout' }, label: _td('Actual Size'),
},
{
role: 'zoomin',
accelerator: 'CommandOrControl+=',
label: _td('Zoom In'),
},
{
role: 'zoomout',
label: _td('Zoom Out'),
},
{ type: 'separator' }, { type: 'separator' },
{ {
label: _td('Preferences'), label: _td('Preferences'),
accelerator: 'Command+,', // Mac-only accelerator accelerator: 'Command+,', // Mac-only accelerator
click() { global.mainWindow.webContents.send('preferences'); }, click() { global.mainWindow.webContents.send('preferences'); },
}, },
{ role: 'togglefullscreen' }, {
{ role: 'toggledevtools' }, role: 'togglefullscreen',
label: _td('Toggle Full Screen'),
},
{
role: 'toggledevtools',
label: _td('Toggle Developer Tools'),
},
], ],
}, },
{ {
@ -58,8 +98,14 @@ function buildMenuTemplate() {
accelerator: 'w', accelerator: 'w',
role: 'window', role: 'window',
submenu: [ submenu: [
{ role: 'minimize' }, {
{ role: 'close' }, role: 'minimize',
label: _td('Minimize'),
},
{
role: 'close',
label: _td('Close'),
},
], ],
}, },
{ {
@ -81,18 +127,34 @@ function buildMenuTemplate() {
// first macOS menu is the name of the app // first macOS menu is the name of the app
label: app.name, label: app.name,
submenu: [ submenu: [
{ role: 'about' }, {
role: 'about',
label: _td('About'),
},
{ type: 'separator' }, { type: 'separator' },
{ {
role: 'services', role: 'services',
label: _td('Services'),
submenu: [], submenu: [],
}, },
{ type: 'separator' }, { type: 'separator' },
{ role: 'hide' }, {
{ role: 'hideothers' }, role: 'hide',
{ role: 'unhide' }, label: _td('Hide'),
},
{
role: 'hideothers',
label: _td('Hide Others'),
},
{
role: 'unhide',
label: _td('Unhide'),
},
{ type: 'separator' }, { type: 'separator' },
{ role: 'quit' }, {
role: 'quit',
label: _td('Quit'),
},
], ],
}); });
// Edit menu. // Edit menu.
@ -102,8 +164,14 @@ function buildMenuTemplate() {
{ {
label: _td('Speech'), label: _td('Speech'),
submenu: [ submenu: [
{ role: 'startspeaking' }, {
{ role: 'stopspeaking' }, role: 'startspeaking',
label: _td('Start Speaking'),
},
{
role: 'stopspeaking',
label: _td('Stop Speaking'),
},
], ],
}); });
@ -139,9 +207,13 @@ function buildMenuTemplate() {
submenu: [ submenu: [
// For some reason, 'about' does not seem to work on windows. // For some reason, 'about' does not seem to work on windows.
/*{ /*{
role: 'about' role: 'about',
label: _td('About'),
},*/ },*/
{ role: 'quit' }, {
role: 'quit',
label: _td('Quit'),
},
], ],
}); });
} }