Added top level menu shortcuts, pull labels from messages.json (#1702)

* Added top level menu shortcuts (Fixes #1688 and #1695).

The ampersand (&) character in front of a letter in a menu label
indicates that the letter that follows '&' will be used as a keyboard
shortcut letter to access this menu. In Windows/Linux, the default
shortcut combination is Alt+<letter>.

* Use non-hardcoded menu labels.

The menu labels were hardcoded in English.
We should not be using plain strings right in the source code, but
pulling them from the `messages.json` files instead.
This commit is contained in:
Vangelis 2017-11-08 00:14:20 +01:00 committed by Scott Nonnenberg
parent 7d53e69958
commit c0c4730bad
2 changed files with 25 additions and 3 deletions

View file

@ -1,4 +1,24 @@
{ {
"mainMenuFile": {
"message": "&File",
"description": "The label that is used for the File menu in the program main menu. The '&' indicates that the following letter will be used as the keyboard 'shortcut letter' for accessing the menu with the Alt-<letter> combination."
},
"mainMenuEdit": {
"message": "&Edit",
"description": "The label that is used for the Edit menu in the program main menu. The '&' indicates that the following letter will be used as the keyboard 'shortcut letter' for accessing the menu with the Alt-<letter> combination."
},
"mainMenuView": {
"message": "&View",
"description": "The label that is used for the View menu in the program main menu. The '&' indicates that the following letter will be used as the keyboard 'shortcut letter' for accessing the menu with the Alt-<letter> combination."
},
"mainMenuWindow": {
"message": "&Window",
"description": "The label that is used for the Window menu in the program main menu. The '&' indicates that the following letter will be used as the keyboard 'shortcut letter' for accessing the menu with the Alt-<letter> combination."
},
"mainMenuHelp": {
"message": "&Help",
"description": "The label that is used for the Help menu in the program main menu. The '&' indicates that the following letter will be used as the keyboard 'shortcut letter' for accessing the menu with the Alt-<letter> combination."
},
"loading": { "loading": {
"message": "Loading...", "message": "Loading...",
"description": "Message shown on the loading screen before we've loaded any messages" "description": "Message shown on the loading screen before we've loaded any messages"

View file

@ -7,7 +7,7 @@ function createTemplate(options, messages) {
const openForums = options.openForums; const openForums = options.openForums;
let template = [{ let template = [{
label: 'File', label: messages.mainMenuFile.message,
submenu: [ submenu: [
{ {
role: 'quit', role: 'quit',
@ -15,7 +15,7 @@ function createTemplate(options, messages) {
] ]
}, },
{ {
label: 'Edit', label: messages.mainMenuEdit.message,
submenu: [ submenu: [
{ {
role: 'undo', role: 'undo',
@ -47,7 +47,7 @@ function createTemplate(options, messages) {
] ]
}, },
{ {
label: 'View', label: messages.mainMenuView.message,
submenu: [ submenu: [
{ {
role: 'resetzoom', role: 'resetzoom',
@ -80,6 +80,7 @@ function createTemplate(options, messages) {
] ]
}, },
{ {
label: messages.mainMenuWindow.message,
role: 'window', role: 'window',
submenu: [ submenu: [
{ {
@ -88,6 +89,7 @@ function createTemplate(options, messages) {
] ]
}, },
{ {
label: messages.mainMenuHelp.message,
role: 'help', role: 'help',
submenu: [ submenu: [
{ {