Skip to content

Commit

Permalink
Add missing access keys (mnemonics) for menu items (#58412)
Browse files Browse the repository at this point in the history
* Add missing access keys (mnemonics) for Update menu items, Add Configuration, Enable All Breakpoints and Auto Save

* adding mnemonics to native menu system
  • Loading branch information
rik-smeets authored and sbatten committed Sep 11, 2018
1 parent 3291fd3 commit 7bca3fb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
16 changes: 8 additions & 8 deletions src/vs/code/electron-main/menus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ export class CodeMenu {

const autoSaveEnabled = [AutoSaveConfiguration.AFTER_DELAY, AutoSaveConfiguration.ON_FOCUS_CHANGE, AutoSaveConfiguration.ON_WINDOW_CHANGE].some(s => this.currentAutoSaveSetting === s);

const autoSave = this.createMenuItem(this.mnemonicLabel(nls.localize('miAutoSave', "Auto Save")), 'workbench.action.toggleAutoSave', this.windowsMainService.getWindowCount() > 0, autoSaveEnabled);
const autoSave = this.createMenuItem(this.mnemonicLabel(nls.localize('miAutoSave', "A&&uto Save")), 'workbench.action.toggleAutoSave', this.windowsMainService.getWindowCount() > 0, autoSaveEnabled);

const preferences = this.getPreferencesMenu();

Expand Down Expand Up @@ -906,7 +906,7 @@ export class CodeMenu {
const restart = this.createMenuItem(nls.localize({ key: 'miRestart Debugging', comment: ['&& denotes a mnemonic'] }, "&&Restart Debugging"), 'workbench.action.debug.restart');

const openConfigurations = this.createMenuItem(nls.localize({ key: 'miOpenConfigurations', comment: ['&& denotes a mnemonic'] }, "Open &&Configurations"), 'workbench.action.debug.configure');
const addConfiguration = this.createMenuItem(nls.localize({ key: 'miAddConfiguration', comment: ['&& denotes a mnemonic'] }, "Add Configuration..."), 'debug.addConfiguration');
const addConfiguration = this.createMenuItem(nls.localize({ key: 'miAddConfiguration', comment: ['&& denotes a mnemonic'] }, "A&&dd Configuration..."), 'debug.addConfiguration');

const stepOver = this.createMenuItem(nls.localize({ key: 'miStepOver', comment: ['&& denotes a mnemonic'] }, "Step &&Over"), 'workbench.action.debug.stepOver');
const stepInto = this.createMenuItem(nls.localize({ key: 'miStepInto', comment: ['&& denotes a mnemonic'] }, "Step &&Into"), 'workbench.action.debug.stepInto');
Expand All @@ -920,7 +920,7 @@ export class CodeMenu {
breakpointsMenu.append(this.createMenuItem(nls.localize({ key: 'miFunctionBreakpoint', comment: ['&& denotes a mnemonic'] }, "&&Function Breakpoint..."), 'workbench.debug.viewlet.action.addFunctionBreakpointAction'));
breakpointsMenu.append(this.createMenuItem(nls.localize({ key: 'miLogPoint', comment: ['&& denotes a mnemonic'] }, "&&Logpoint..."), 'editor.debug.action.toggleLogPoint'));
const newBreakpoints = new MenuItem({ label: this.mnemonicLabel(nls.localize({ key: 'miNewBreakpoint', comment: ['&& denotes a mnemonic'] }, "&&New Breakpoint")), submenu: breakpointsMenu });
const enableAllBreakpoints = this.createMenuItem(nls.localize({ key: 'miEnableAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Enable All Breakpoints"), 'workbench.debug.viewlet.action.enableAllBreakpoints');
const enableAllBreakpoints = this.createMenuItem(nls.localize({ key: 'miEnableAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "&&Enable All Breakpoints"), 'workbench.debug.viewlet.action.enableAllBreakpoints');
const disableAllBreakpoints = this.createMenuItem(nls.localize({ key: 'miDisableAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Disable A&&ll Breakpoints"), 'workbench.debug.viewlet.action.disableAllBreakpoints');
const removeAllBreakpoints = this.createMenuItem(nls.localize({ key: 'miRemoveAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Remove &&All Breakpoints"), 'workbench.debug.viewlet.action.removeAllBreakpoints');

Expand Down Expand Up @@ -1098,7 +1098,7 @@ export class CodeMenu {

case StateType.Idle:
return [new MenuItem({
label: nls.localize('miCheckForUpdates', "Check for Updates..."), click: () => setTimeout(() => {
label: nls.localize('miCheckForUpdates', "Check for &&Updates..."), click: () => setTimeout(() => {
this.reportMenuActionTelemetry('CheckForUpdate');

const focusedWindow = this.windowsMainService.getFocusedWindow();
Expand All @@ -1112,7 +1112,7 @@ export class CodeMenu {

case StateType.AvailableForDownload:
return [new MenuItem({
label: nls.localize('miDownloadUpdate', "Download Available Update"), click: () => {
label: nls.localize('miDownloadUpdate', "D&&ownload Available Update"), click: () => {
this.updateService.downloadUpdate();
}
})];
Expand All @@ -1122,7 +1122,7 @@ export class CodeMenu {

case StateType.Downloaded:
return [new MenuItem({
label: nls.localize('miInstallUpdate', "Install Update..."), click: () => {
label: nls.localize('miInstallUpdate', "Install &&Update..."), click: () => {
this.reportMenuActionTelemetry('InstallUpdate');
this.updateService.applyUpdate();
}
Expand All @@ -1133,7 +1133,7 @@ export class CodeMenu {

case StateType.Ready:
return [new MenuItem({
label: nls.localize('miRestartToUpdate', "Restart to Update..."), click: () => {
label: nls.localize('miRestartToUpdate', "Restart to &&Update..."), click: () => {
this.reportMenuActionTelemetry('RestartToUpdate');
this.updateService.quitAndInstall();
}
Expand Down Expand Up @@ -1281,4 +1281,4 @@ export class CodeMenu {

function __separator__(): Electron.MenuItem {
return new MenuItem({ type: 'separator' });
}
}
8 changes: 4 additions & 4 deletions src/vs/platform/menubar/electron-main/menubar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ export class Menubar {

case StateType.Idle:
return [new MenuItem({
label: nls.localize('miCheckForUpdates', "Check for Updates..."), click: () => setTimeout(() => {
label: nls.localize('miCheckForUpdates', "Check for &&Updates..."), click: () => setTimeout(() => {
this.reportMenuActionTelemetry('CheckForUpdate');

const focusedWindow = this.windowsMainService.getFocusedWindow();
Expand All @@ -631,7 +631,7 @@ export class Menubar {

case StateType.AvailableForDownload:
return [new MenuItem({
label: nls.localize('miDownloadUpdate', "Download Available Update"), click: () => {
label: nls.localize('miDownloadUpdate', "D&&ownload Available Update"), click: () => {
this.updateService.downloadUpdate();
}
})];
Expand All @@ -641,7 +641,7 @@ export class Menubar {

case StateType.Downloaded:
return [new MenuItem({
label: nls.localize('miInstallUpdate', "Install Update..."), click: () => {
label: nls.localize('miInstallUpdate', "Install &&Update..."), click: () => {
this.reportMenuActionTelemetry('InstallUpdate');
this.updateService.applyUpdate();
}
Expand All @@ -652,7 +652,7 @@ export class Menubar {

case StateType.Ready:
return [new MenuItem({
label: nls.localize('miRestartToUpdate', "Restart to Update..."), click: () => {
label: nls.localize('miRestartToUpdate', "Restart to &&Update..."), click: () => {
this.reportMenuActionTelemetry('RestartToUpdate');
this.updateService.quitAndInstall();
}
Expand Down
8 changes: 4 additions & 4 deletions src/vs/workbench/browser/parts/titlebar/menubarControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,28 +594,28 @@ export class MenubarControl extends Disposable {

case StateType.Idle:
const windowId = this.windowService.getCurrentWindowId();
return new Action('update.check', nls.localize('checkForUpdates', "Check for Updates..."), undefined, true, () =>
return new Action('update.check', nls.localize({ key: 'checkForUpdates', comment: ['&& denotes a mnemonic'] }, "Check for &&Updates..."), undefined, true, () =>
this.updateService.checkForUpdates({ windowId }));

case StateType.CheckingForUpdates:
return new Action('update.checking', nls.localize('checkingForUpdates', "Checking For Updates..."), undefined, false);

case StateType.AvailableForDownload:
return new Action('update.downloadNow', nls.localize('download now', "Download Now"), null, true, () =>
return new Action('update.downloadNow', nls.localize({ key: 'download now', comment: ['&& denotes a mnemonic'] }, "D&&ownload Now"), null, true, () =>
this.updateService.downloadUpdate());

case StateType.Downloading:
return new Action('update.downloading', nls.localize('DownloadingUpdate', "Downloading Update..."), undefined, false);

case StateType.Downloaded:
return new Action('update.install', nls.localize('installUpdate...', "Install Update..."), undefined, true, () =>
return new Action('update.install', nls.localize({ key: 'installUpdate...', comment: ['&& denotes a mnemonic'] }, "Install &&Update..."), undefined, true, () =>
this.updateService.applyUpdate());

case StateType.Updating:
return new Action('update.updating', nls.localize('installingUpdate', "Installing Update..."), undefined, false);

case StateType.Ready:
return new Action('update.restart', nls.localize('restartToUpdate', "Restart to Update..."), undefined, true, () =>
return new Action('update.restart', nls.localize({ key: 'restartToUpdate', comment: ['&& denotes a mnemonic'] }, "Restart to &&Update..."), undefined, true, () =>
this.updateService.quitAndInstall());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '2_configuration',
command: {
id: ADD_CONFIGURATION_ID,
title: nls.localize({ key: 'miAddConfiguration', comment: ['&& denotes a mnemonic'] }, "Add Configuration...")
title: nls.localize({ key: 'miAddConfiguration', comment: ['&& denotes a mnemonic'] }, "A&&dd Configuration...")
},
order: 2
});
Expand Down Expand Up @@ -407,7 +407,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '5_breakpoints',
command: {
id: EnableAllBreakpointsAction.ID,
title: nls.localize({ key: 'miEnableAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Enable All Breakpoints")
title: nls.localize({ key: 'miEnableAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "&&Enable All Breakpoints")
},
order: 1
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '5_autosave',
command: {
id: ToggleAutoSaveAction.ID,
title: nls.localize('miAutoSave', "Auto Save")
title: nls.localize({ key: 'miAutoSave', comment: ['&& denotes a mnemonic'] }, "A&&uto Save")
},
order: 1
});
Expand Down

0 comments on commit 7bca3fb

Please sign in to comment.