Make all OS menus localizable

Turns out that Electron is not localizing the 'role' elements like we
expected would happen.
This commit is contained in:
Scott Nonnenberg 2018-06-22 18:08:14 -07:00
parent 1f02d411a1
commit 4415293100
6 changed files with 193 additions and 0 deletions

View File

@ -27,6 +27,98 @@
"message": "Preferences…",
"description": "The label that is used for the Preferences menu in the program main menu. This should be consistent with the standard naming for Preferences on the operating system."
},
"appMenuHide": {
"message": "Hide",
"description": "Application menu command to hide the window"
},
"appMenuHideOthers": {
"message": "Hide Others",
"description": "Application menu command to hide all other windows"
},
"appMenuUnhide": {
"message": "Show All",
"description": "Application menu command to show all application windows"
},
"appMenuQuit": {
"message": "Quit Signal",
"description": "Application menu command to close the application"
},
"editMenuUndo": {
"message": "Undo",
"description": "Edit menu command to remove recently-typed text"
},
"editMenuRedo": {
"message": "Redo",
"description": "Edit menu command to restore previously undone typed text"
},
"editMenuCut": {
"message": "Cut",
"description": "Edit menu command to remove selected text and add it to clipboard"
},
"editMenuCopy": {
"message": "Copy",
"description": "Edit menu command to add selected text to clipboard"
},
"editMenuPaste": {
"message": "Paste",
"description": "Edit menu command to insert text from clipboard at cursor location"
},
"editMenuPasteAndMatchStyle": {
"message": "Paste and Match Style",
"description": "Edit menu command to insert text from clipboard at cursor location, taking only text and not style information"
},
"editMenuDelete": {
"message": "Delete",
"description": "Edit menu command to remove the selected text"
},
"editMenuSelectAll": {
"message": "Select All",
"description": "Edit menu comand to select all of the text in selected text box"
},
"editMenuStartSpeaking": {
"message": "Start speaking",
"description": "Edit menu item under 'speech' to start dictation"
},
"editMenuStopSpeaking": {
"message": "Stop speaking",
"description": "Edit menu item under 'speech' to stop dictation"
},
"windowMenuClose": {
"message": "Close Window",
"description": "Window menu command to close the current window"
},
"windowMenuMinimize": {
"message": "Minimize",
"description": "Window menu command to minimize the current window"
},
"windowMenuZoom": {
"message": "Zoom",
"description": "Window menu command to make the current window the size of the whole screen"
},
"windowMenuBringAllToFront": {
"message": "Bring All to Front",
"description": "Window menu command to bring all windows of current applicatinon to front"
},
"viewMenuResetZoom": {
"message": "Actual Size",
"description": "View menu command to go back to the default zoom"
},
"viewMenuZoomIn": {
"message": "Zoom In",
"description": "View menu command to make everything bigger"
},
"viewMenuZoomOut": {
"message": "Zoom Out",
"description": "View menu command to make everything smaller"
},
"viewMenuToggleFullScreen": {
"message": "Toggle Full Screen",
"description": "View menu command to enter or leave Full Screen mode"
},
"viewMenuToggleDevTools": {
"message": "Toggle Developer Tools",
"description": "View menu command to show or hide the developer tools"
},
"menuSetupWithImport": {
"message": "Set Up with Import",
"description": "When the application is not yet set up, menu option to start up the import sequence"

View File

@ -33,6 +33,7 @@ exports.createTemplate = (options, messages) => {
},
{
role: 'quit',
label: messages.appMenuQuit.message,
},
],
},
@ -41,30 +42,38 @@ exports.createTemplate = (options, messages) => {
submenu: [
{
role: 'undo',
label: messages.editMenuUndo.message,
},
{
role: 'redo',
label: messages.editMenuRedo.message,
},
{
type: 'separator',
},
{
role: 'cut',
label: messages.editMenuCut.message,
},
{
role: 'copy',
label: messages.editMenuCopy.message,
},
{
role: 'paste',
label: messages.editMenuPaste.message,
},
{
role: 'pasteandmatchstyle',
label: messages.editMenuPasteAndMatchStyle.message,
},
{
role: 'delete',
label: messages.editMenuDelete.message,
},
{
role: 'selectall',
label: messages.editMenuSelectAll.message,
},
],
},
@ -73,18 +82,22 @@ exports.createTemplate = (options, messages) => {
submenu: [
{
role: 'resetzoom',
label: messages.viewMenuResetZoom.message,
},
{
role: 'zoomin',
label: messages.viewMenuZoomIn.message,
},
{
role: 'zoomout',
label: messages.viewMenuZoomOut.message,
},
{
type: 'separator',
},
{
role: 'togglefullscreen',
label: messages.viewMenuToggleFullScreen.message,
},
{
type: 'separator',
@ -98,6 +111,7 @@ exports.createTemplate = (options, messages) => {
},
{
role: 'toggledevtools',
label: messages.viewMenuToggleDevTools.message,
},
],
},
@ -107,6 +121,7 @@ exports.createTemplate = (options, messages) => {
submenu: [
{
role: 'minimize',
label: messages.windowMenuMinimize.message,
},
],
},
@ -239,18 +254,22 @@ function updateForMac(template, messages, options) {
type: 'separator',
},
{
label: messages.appMenuHide.message,
role: 'hide',
},
{
label: messages.appMenuHideOthers.message,
role: 'hideothers',
},
{
label: messages.appMenuUnhide.message,
role: 'unhide',
},
{
type: 'separator',
},
{
label: messages.appMenuQuit.message,
role: 'quit',
},
],
@ -267,9 +286,11 @@ function updateForMac(template, messages, options) {
submenu: [
{
role: 'startspeaking',
label: messages.editMenuStartSpeaking.message,
},
{
role: 'stopspeaking',
label: messages.editMenuStopSpeaking.message,
},
],
}
@ -280,14 +301,17 @@ function updateForMac(template, messages, options) {
// eslint-disable-next-line no-param-reassign
template[windowMenuTemplateIndex].submenu = [
{
label: messages.windowMenuClose.message,
accelerator: 'CmdOrCtrl+W',
role: 'close',
},
{
label: messages.windowMenuMinimize.message,
accelerator: 'CmdOrCtrl+M',
role: 'minimize',
},
{
label: messages.windowMenuZoom.message,
role: 'zoom',
},
{
@ -299,6 +323,7 @@ function updateForMac(template, messages, options) {
},
{
role: 'front',
label: messages.windowMenuBringAllToFront.message,
},
];

View File

@ -17,18 +17,22 @@
"type": "separator"
},
{
"label": "Hide",
"role": "hide"
},
{
"label": "Hide Others",
"role": "hideothers"
},
{
"label": "Show All",
"role": "unhide"
},
{
"type": "separator"
},
{
"label": "Quit Signal",
"role": "quit"
}
]
@ -50,30 +54,38 @@
"label": "&Edit",
"submenu": [
{
"label": "Undo",
"role": "undo"
},
{
"label": "Redo",
"role": "redo"
},
{
"type": "separator"
},
{
"label": "Cut",
"role": "cut"
},
{
"label": "Copy",
"role": "copy"
},
{
"label": "Paste",
"role": "paste"
},
{
"label": "Paste and Match Style",
"role": "pasteandmatchstyle"
},
{
"label": "Delete",
"role": "delete"
},
{
"label": "Select All",
"role": "selectall"
},
{
@ -83,9 +95,11 @@
"label": "Speech",
"submenu": [
{
"label": "Start speaking",
"role": "startspeaking"
},
{
"label": "Stop speaking",
"role": "stopspeaking"
}
]
@ -96,18 +110,22 @@
"label": "&View",
"submenu": [
{
"label": "Actual Size",
"role": "resetzoom"
},
{
"label": "Zoom In",
"role": "zoomin"
},
{
"label": "Zoom Out",
"role": "zoomout"
},
{
"type": "separator"
},
{
"label": "Toggle Full Screen",
"role": "togglefullscreen"
},
{
@ -121,6 +139,7 @@
"type": "separator"
},
{
"label": "Toggle Developer Tools",
"role": "toggledevtools"
}
]
@ -130,14 +149,17 @@
"role": "window",
"submenu": [
{
"label": "Close Window",
"accelerator": "CmdOrCtrl+W",
"role": "close"
},
{
"label": "Minimize",
"accelerator": "CmdOrCtrl+M",
"role": "minimize"
},
{
"label": "Zoom",
"role": "zoom"
},
{
@ -148,6 +170,7 @@
"type": "separator"
},
{
"label": "Bring All to Front",
"role": "front"
}
]

View File

@ -17,18 +17,22 @@
"type": "separator"
},
{
"label": "Hide",
"role": "hide"
},
{
"label": "Hide Others",
"role": "hideothers"
},
{
"label": "Show All",
"role": "unhide"
},
{
"type": "separator"
},
{
"label": "Quit Signal",
"role": "quit"
}
]
@ -37,30 +41,38 @@
"label": "&Edit",
"submenu": [
{
"label": "Undo",
"role": "undo"
},
{
"label": "Redo",
"role": "redo"
},
{
"type": "separator"
},
{
"label": "Cut",
"role": "cut"
},
{
"label": "Copy",
"role": "copy"
},
{
"label": "Paste",
"role": "paste"
},
{
"label": "Paste and Match Style",
"role": "pasteandmatchstyle"
},
{
"label": "Delete",
"role": "delete"
},
{
"label": "Select All",
"role": "selectall"
},
{
@ -70,9 +82,11 @@
"label": "Speech",
"submenu": [
{
"label": "Start speaking",
"role": "startspeaking"
},
{
"label": "Stop speaking",
"role": "stopspeaking"
}
]
@ -83,18 +97,22 @@
"label": "&View",
"submenu": [
{
"label": "Actual Size",
"role": "resetzoom"
},
{
"label": "Zoom In",
"role": "zoomin"
},
{
"label": "Zoom Out",
"role": "zoomout"
},
{
"type": "separator"
},
{
"label": "Toggle Full Screen",
"role": "togglefullscreen"
},
{
@ -108,6 +126,7 @@
"type": "separator"
},
{
"label": "Toggle Developer Tools",
"role": "toggledevtools"
}
]
@ -117,14 +136,17 @@
"role": "window",
"submenu": [
{
"label": "Close Window",
"accelerator": "CmdOrCtrl+W",
"role": "close"
},
{
"label": "Minimize",
"accelerator": "CmdOrCtrl+M",
"role": "minimize"
},
{
"label": "Zoom",
"role": "zoom"
},
{
@ -135,6 +157,7 @@
"type": "separator"
},
{
"label": "Bring All to Front",
"role": "front"
}
]

View File

@ -21,6 +21,7 @@
"type": "separator"
},
{
"label": "Quit Signal",
"role": "quit"
}
]
@ -29,30 +30,38 @@
"label": "&Edit",
"submenu": [
{
"label": "Undo",
"role": "undo"
},
{
"label": "Redo",
"role": "redo"
},
{
"type": "separator"
},
{
"label": "Cut",
"role": "cut"
},
{
"label": "Copy",
"role": "copy"
},
{
"label": "Paste",
"role": "paste"
},
{
"label": "Paste and Match Style",
"role": "pasteandmatchstyle"
},
{
"label": "Delete",
"role": "delete"
},
{
"label": "Select All",
"role": "selectall"
}
]
@ -61,18 +70,22 @@
"label": "&View",
"submenu": [
{
"label": "Actual Size",
"role": "resetzoom"
},
{
"label": "Zoom In",
"role": "zoomin"
},
{
"label": "Zoom Out",
"role": "zoomout"
},
{
"type": "separator"
},
{
"label": "Toggle Full Screen",
"role": "togglefullscreen"
},
{
@ -86,6 +99,7 @@
"type": "separator"
},
{
"label": "Toggle Developer Tools",
"role": "toggledevtools"
}
]
@ -95,6 +109,7 @@
"role": "window",
"submenu": [
{
"label": "Minimize",
"role": "minimize"
}
]

View File

@ -10,6 +10,7 @@
"type": "separator"
},
{
"label": "Quit Signal",
"role": "quit"
}
]
@ -18,30 +19,38 @@
"label": "&Edit",
"submenu": [
{
"label": "Undo",
"role": "undo"
},
{
"label": "Redo",
"role": "redo"
},
{
"type": "separator"
},
{
"label": "Cut",
"role": "cut"
},
{
"label": "Copy",
"role": "copy"
},
{
"label": "Paste",
"role": "paste"
},
{
"label": "Paste and Match Style",
"role": "pasteandmatchstyle"
},
{
"label": "Delete",
"role": "delete"
},
{
"label": "Select All",
"role": "selectall"
}
]
@ -50,18 +59,22 @@
"label": "&View",
"submenu": [
{
"label": "Actual Size",
"role": "resetzoom"
},
{
"label": "Zoom In",
"role": "zoomin"
},
{
"label": "Zoom Out",
"role": "zoomout"
},
{
"type": "separator"
},
{
"label": "Toggle Full Screen",
"role": "togglefullscreen"
},
{
@ -75,6 +88,7 @@
"type": "separator"
},
{
"label": "Toggle Developer Tools",
"role": "toggledevtools"
}
]
@ -84,6 +98,7 @@
"role": "window",
"submenu": [
{
"label": "Minimize",
"role": "minimize"
}
]