From aeffacbe0a9e2ae416b9a237e21ecbd99aa2977e Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Tue, 24 Dec 2024 11:12:18 +0800 Subject: [PATCH 1/5] * Make Cmd left/right go back/forward --- src/constants.js | 2 ++ src/main/index.js | 28 +++++++++++++++++++ .../FtKeyboardShortcutPrompt.vue | 8 ++++++ src/renderer/components/top-nav/top-nav.js | 14 ++++++++-- src/renderer/helpers/utils.js | 12 +++++--- static/locales/en-US.yaml | 2 ++ 6 files changed, 60 insertions(+), 6 deletions(-) diff --git a/src/constants.js b/src/constants.js index c21ace4448a8c..1cf16284c7492 100644 --- a/src/constants.js +++ b/src/constants.js @@ -127,6 +127,8 @@ const KeyboardShortcuts = { SHOW_SHORTCUTS: 'shift+?', HISTORY_BACKWARD: 'alt+arrowleft', HISTORY_FORWARD: 'alt+arrowright', + HISTORY_BACKWARD_ALT_MAC: 'cmd+arrowleft', + HISTORY_FORWARD_ALT_MAC: 'cmd+arrowright', FULLSCREEN: 'f11', NAVIGATE_TO_SETTINGS: 'ctrl+,', NAVIGATE_TO_HISTORY: 'ctrl+H', diff --git a/src/main/index.js b/src/main/index.js index 739ff9ee78f47..eeb5508ef121f 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -1702,6 +1702,20 @@ function runApp() { }, type: 'normal', }, + ...(process.platform === 'darwin' + ? [ + { + label: 'Back', + accelerator: 'Cmd+Left', + click: (_menuItem, browserWindow, _event) => { + if (browserWindow == null) { return } + + browserWindow.webContents.navigationHistory.goBack() + }, + visible: false, + }, + ] + : []), { label: 'Forward', accelerator: 'Alt+Right', @@ -1712,6 +1726,20 @@ function runApp() { }, type: 'normal', }, + ...(process.platform === 'darwin' + ? [ + { + label: 'Forward', + accelerator: 'Cmd+Right', + click: (_menuItem, browserWindow, _event) => { + if (browserWindow == null) { return } + + browserWindow.webContents.navigationHistory.goForward() + }, + visible: false, + }, + ] + : []), ] }, { diff --git a/src/renderer/components/FtKeyboardShortcutPrompt/FtKeyboardShortcutPrompt.vue b/src/renderer/components/FtKeyboardShortcutPrompt/FtKeyboardShortcutPrompt.vue index 409f0d5ef9575..7e10ebc7ff252 100644 --- a/src/renderer/components/FtKeyboardShortcutPrompt/FtKeyboardShortcutPrompt.vue +++ b/src/renderer/components/FtKeyboardShortcutPrompt/FtKeyboardShortcutPrompt.vue @@ -115,6 +115,14 @@ const localizedShortcutNameDictionary = computed(() => { ['SHOW_SHORTCUTS', t('KeyboardShortcutPrompt.Show Keyboard Shortcuts')], ['HISTORY_BACKWARD', t('KeyboardShortcutPrompt.History Backward')], ['HISTORY_FORWARD', t('KeyboardShortcutPrompt.History Forward')], + ...( + isMac + ? [ + ['HISTORY_BACKWARD_ALT_MAC', t('KeyboardShortcutPrompt.History Backward (Mac only)')], + ['HISTORY_FORWARD_ALT_MAC', t('KeyboardShortcutPrompt.History Forward (Mac only)')], + ] + : [] + ), ['FULLSCREEN', t('KeyboardShortcutPrompt.Fullscreen')], ['NAVIGATE_TO_SETTINGS', t('KeyboardShortcutPrompt.Navigate to Settings')], ( diff --git a/src/renderer/components/top-nav/top-nav.js b/src/renderer/components/top-nav/top-nav.js index f86c1dd2fa5fa..c4124efe749d3 100644 --- a/src/renderer/components/top-nav/top-nav.js +++ b/src/renderer/components/top-nav/top-nav.js @@ -101,16 +101,26 @@ export default defineComponent({ }, forwardText: function () { + const shortcuts = [KeyboardShortcuts.APP.GENERAL.HISTORY_FORWARD] + if (process.platform === 'darwin') { + shortcuts.push(KeyboardShortcuts.APP.GENERAL.HISTORY_FORWARD_ALT_MAC) + } + return localizeAndAddKeyboardShortcutToActionTitle( this.$t('Forward'), - KeyboardShortcuts.APP.GENERAL.HISTORY_FORWARD + shortcuts, ) + this.navigationHistoryAddendum }, backwardText: function () { + const shortcuts = [KeyboardShortcuts.APP.GENERAL.HISTORY_BACKWARD] + if (process.platform === 'darwin') { + shortcuts.push(KeyboardShortcuts.APP.GENERAL.HISTORY_BACKWARD_ALT_MAC) + } + return localizeAndAddKeyboardShortcutToActionTitle( this.$t('Back'), - KeyboardShortcuts.APP.GENERAL.HISTORY_BACKWARD + shortcuts, ) + this.navigationHistoryAddendum }, diff --git a/src/renderer/helpers/utils.js b/src/renderer/helpers/utils.js index 5a54c2bc1782f..444ddfbd1a071 100644 --- a/src/renderer/helpers/utils.js +++ b/src/renderer/helpers/utils.js @@ -1021,10 +1021,14 @@ export function addKeyboardShortcutToActionTitle(actionTitle, shortcut) { /** * @param {string} localizedActionTitle - * @param {string} unlocalizedShortcut + * @param {string|string[]} sometimesManyUnlocalizedShortcuts * @returns {string} the localized action title with keyboard shortcut */ -export function localizeAndAddKeyboardShortcutToActionTitle(localizedActionTitle, unlocalizedShortcut) { - const localizedShortcut = getLocalizedShortcut(unlocalizedShortcut) - return addKeyboardShortcutToActionTitle(localizedActionTitle, localizedShortcut) +export function localizeAndAddKeyboardShortcutToActionTitle(localizedActionTitle, sometimesManyUnlocalizedShortcuts) { + let unlocalizedShortcuts = sometimesManyUnlocalizedShortcuts + if (!Array.isArray(sometimesManyUnlocalizedShortcuts)) { + unlocalizedShortcuts = [unlocalizedShortcuts] + } + const localizedShortcuts = unlocalizedShortcuts.map((s) => getLocalizedShortcut(s)) + return addKeyboardShortcutToActionTitle(localizedActionTitle, localizedShortcuts.join('/')) } diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml index 11599e1b60b97..29320bbdb1e0f 100644 --- a/static/locales/en-US.yaml +++ b/static/locales/en-US.yaml @@ -1146,6 +1146,8 @@ KeyboardShortcutPrompt: Show Keyboard Shortcuts: Show keyboard shortcuts History Backward: Go back one page History Forward: Go forward one page + History Backward (Mac only): Go back one page (Mac only) + History Forward (Mac only): Go forward one page (Mac only) New Window: Create a new window Navigate to Settings: Navigate to the Settings page Navigate to History: Navigate to the History page From a32e33296bc6a13495a218f0475e8fa9d2152fcb Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Sun, 29 Dec 2024 08:51:53 +0800 Subject: [PATCH 2/5] ! Fix wrong new shortcut --- src/constants.js | 4 ++-- src/main/index.js | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/constants.js b/src/constants.js index 1cf16284c7492..b7f37a3213895 100644 --- a/src/constants.js +++ b/src/constants.js @@ -127,8 +127,8 @@ const KeyboardShortcuts = { SHOW_SHORTCUTS: 'shift+?', HISTORY_BACKWARD: 'alt+arrowleft', HISTORY_FORWARD: 'alt+arrowright', - HISTORY_BACKWARD_ALT_MAC: 'cmd+arrowleft', - HISTORY_FORWARD_ALT_MAC: 'cmd+arrowright', + HISTORY_BACKWARD_ALT_MAC: 'cmd+[', + HISTORY_FORWARD_ALT_MAC: 'cmd+]', FULLSCREEN: 'f11', NAVIGATE_TO_SETTINGS: 'ctrl+,', NAVIGATE_TO_HISTORY: 'ctrl+H', diff --git a/src/main/index.js b/src/main/index.js index eeb5508ef121f..87bdd3d6517f4 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -11,6 +11,7 @@ import { DBActions, SyncEvents, ABOUT_BITCOIN_ADDRESS, + KeyboardShortcuts, } from '../constants' import * as baseHandlers from '../datastores/handlers/base' import { extractExpiryTimestamp, ImageCache } from './ImageCache' @@ -1706,7 +1707,7 @@ function runApp() { ? [ { label: 'Back', - accelerator: 'Cmd+Left', + accelerator: KeyboardShortcuts.APP.GENERAL.HISTORY_BACKWARD_ALT_MAC, click: (_menuItem, browserWindow, _event) => { if (browserWindow == null) { return } @@ -1730,7 +1731,7 @@ function runApp() { ? [ { label: 'Forward', - accelerator: 'Cmd+Right', + accelerator: KeyboardShortcuts.APP.GENERAL.HISTORY_FORWARD_ALT_MAC, click: (_menuItem, browserWindow, _event) => { if (browserWindow == null) { return } From 98d8e39bf5b1ff0774afa81b31060ec2a6a9dcdb Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Sun, 29 Dec 2024 08:52:16 +0800 Subject: [PATCH 3/5] * Allow shortcut label separator to be translated --- src/renderer/helpers/utils.js | 3 ++- static/locales/en-US.yaml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/renderer/helpers/utils.js b/src/renderer/helpers/utils.js index 444ddfbd1a071..92b9ab6067993 100644 --- a/src/renderer/helpers/utils.js +++ b/src/renderer/helpers/utils.js @@ -1030,5 +1030,6 @@ export function localizeAndAddKeyboardShortcutToActionTitle(localizedActionTitle unlocalizedShortcuts = [unlocalizedShortcuts] } const localizedShortcuts = unlocalizedShortcuts.map((s) => getLocalizedShortcut(s)) - return addKeyboardShortcutToActionTitle(localizedActionTitle, localizedShortcuts.join('/')) + const shortcutLabelSeparator = i18n.t('shortcutLabelSeparator') + return addKeyboardShortcutToActionTitle(localizedActionTitle, localizedShortcuts.join(shortcutLabelSeparator)) } diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml index 29320bbdb1e0f..6acabfca1c3c5 100644 --- a/static/locales/en-US.yaml +++ b/static/locales/en-US.yaml @@ -1124,6 +1124,7 @@ checkmark: ✓ Display Label: '{label}: {value}' KeyboardShortcutTemplate: '{label} ({shortcut})' shortcutJoinOperator: + +shortcutLabelSeparator: / Keys: alt: Alt ctrl: Ctrl From aa69384144c4663c29401ca76d99b62fce762255 Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Fri, 3 Jan 2025 06:47:37 +0800 Subject: [PATCH 4/5] * Show one action per shortcut action with N shortcuts --- .../FtKeyboardShortcutPrompt.vue | 127 +++++++++--------- 1 file changed, 62 insertions(+), 65 deletions(-) diff --git a/src/renderer/components/FtKeyboardShortcutPrompt/FtKeyboardShortcutPrompt.vue b/src/renderer/components/FtKeyboardShortcutPrompt/FtKeyboardShortcutPrompt.vue index 7e10ebc7ff252..21df78627bf10 100644 --- a/src/renderer/components/FtKeyboardShortcutPrompt/FtKeyboardShortcutPrompt.vue +++ b/src/renderer/components/FtKeyboardShortcutPrompt/FtKeyboardShortcutPrompt.vue @@ -110,64 +110,60 @@ const primarySections = computed(() => [ const isMac = process.platform === 'darwin' -const localizedShortcutNameDictionary = computed(() => { +const localizedShortcutNameToShortcutsMap = computed(() => { return new Map([ - ['SHOW_SHORTCUTS', t('KeyboardShortcutPrompt.Show Keyboard Shortcuts')], - ['HISTORY_BACKWARD', t('KeyboardShortcutPrompt.History Backward')], - ['HISTORY_FORWARD', t('KeyboardShortcutPrompt.History Forward')], - ...( - isMac - ? [ - ['HISTORY_BACKWARD_ALT_MAC', t('KeyboardShortcutPrompt.History Backward (Mac only)')], - ['HISTORY_FORWARD_ALT_MAC', t('KeyboardShortcutPrompt.History Forward (Mac only)')], - ] - : [] - ), - ['FULLSCREEN', t('KeyboardShortcutPrompt.Fullscreen')], - ['NAVIGATE_TO_SETTINGS', t('KeyboardShortcutPrompt.Navigate to Settings')], - ( - isMac - ? ['NAVIGATE_TO_HISTORY_MAC', t('KeyboardShortcutPrompt.Navigate to History')] - : ['NAVIGATE_TO_HISTORY', t('KeyboardShortcutPrompt.Navigate to History')] - ), - ['NEW_WINDOW', t('KeyboardShortcutPrompt.New Window')], - ['MINIMIZE_WINDOW', t('KeyboardShortcutPrompt.Minimize Window')], - ['CLOSE_WINDOW', t('KeyboardShortcutPrompt.Close Window')], - ['RESTART_WINDOW', t('KeyboardShortcutPrompt.Restart Window')], - ['FORCE_RESTART_WINDOW', t('KeyboardShortcutPrompt.Force Restart Window')], - ['TOGGLE_DEVTOOLS', t('KeyboardShortcutPrompt.Toggle Developer Tools')], - ['RESET_ZOOM', t('KeyboardShortcutPrompt.Reset Zoom')], - ['ZOOM_IN', t('KeyboardShortcutPrompt.Zoom In')], - ['ZOOM_OUT', t('KeyboardShortcutPrompt.Zoom Out')], - ['FOCUS_SEARCH', t('KeyboardShortcutPrompt.Focus Search')], - ['SEARCH_IN_NEW_WINDOW', t('KeyboardShortcutPrompt.Search in New Window')], - - ['REFRESH', t('KeyboardShortcutPrompt.Refresh')], - ['FOCUS_SECONDARY_SEARCH', t('KeyboardShortcutPrompt.Focus Secondary Search')], - - ['CAPTIONS', t('KeyboardShortcutPrompt.Captions')], - ['THEATRE_MODE', t('KeyboardShortcutPrompt.Theatre Mode')], - ['FULLSCREEN', t('KeyboardShortcutPrompt.Fullscreen')], - ['FULLWINDOW', t('KeyboardShortcutPrompt.Full Window')], - ['PICTURE_IN_PICTURE', t('KeyboardShortcutPrompt.Picture in Picture')], - ['MUTE', t('KeyboardShortcutPrompt.Mute')], - ['VOLUME_UP', t('KeyboardShortcutPrompt.Volume Up')], - ['VOLUME_DOWN', t('KeyboardShortcutPrompt.Volume Down')], - ['TAKE_SCREENSHOT', t('KeyboardShortcutPrompt.Take Screenshot')], - ['STATS', t('KeyboardShortcutPrompt.Stats')], - - ['PLAY', t('KeyboardShortcutPrompt.Play')], - ['LARGE_REWIND', t('KeyboardShortcutPrompt.Large Rewind')], - ['LARGE_FAST_FORWARD', t('KeyboardShortcutPrompt.Large Fast Forward')], - ['SMALL_REWIND', t('KeyboardShortcutPrompt.Small Rewind')], - ['SMALL_FAST_FORWARD', t('KeyboardShortcutPrompt.Small Fast Forward')], - ['DECREASE_VIDEO_SPEED', t('KeyboardShortcutPrompt.Decrease Video Speed')], - ['INCREASE_VIDEO_SPEED', t('KeyboardShortcutPrompt.Increase Video Speed')], - ['SKIP_N_TENTHS', t('KeyboardShortcutPrompt.Skip by Tenths')], - ['LAST_CHAPTER', t('KeyboardShortcutPrompt.Last Chapter')], - ['NEXT_CHAPTER', t('KeyboardShortcutPrompt.Next Chapter')], - ['LAST_FRAME', t('KeyboardShortcutPrompt.Last Frame')], - ['NEXT_FRAME', t('KeyboardShortcutPrompt.Next Frame')], + [t('KeyboardShortcutPrompt.Show Keyboard Shortcuts'), ['SHOW_SHORTCUTS']], + [t('KeyboardShortcutPrompt.History Backward'), [ + 'HISTORY_BACKWARD', + ...isMac ? ['HISTORY_BACKWARD_ALT_MAC'] : [], + ]], + [t('KeyboardShortcutPrompt.History Forward'), [ + 'HISTORY_FORWARD', + ...isMac ? ['HISTORY_FORWARD_ALT_MAC'] : [], + ]], + [t('KeyboardShortcutPrompt.Fullscreen'), ['FULLSCREEN']], + [t('KeyboardShortcutPrompt.Navigate to Settings'), ['NAVIGATE_TO_SETTINGS']], + [t('KeyboardShortcutPrompt.Navigate to History'), [ + isMac ? 'NAVIGATE_TO_HISTORY_MAC' : 'NAVIGATE_TO_HISTORY', + ]], + [t('KeyboardShortcutPrompt.New Window'), ['NEW_WINDOW']], + [t('KeyboardShortcutPrompt.Minimize Window'), ['MINIMIZE_WINDOW']], + [t('KeyboardShortcutPrompt.Close Window'), ['CLOSE_WINDOW']], + [t('KeyboardShortcutPrompt.Restart Window'), ['RESTART_WINDOW']], + [t('KeyboardShortcutPrompt.Force Restart Window'), ['FORCE_RESTART_WINDOW']], + [t('KeyboardShortcutPrompt.Toggle Developer Tools'), ['TOGGLE_DEVTOOLS']], + [t('KeyboardShortcutPrompt.Reset Zoom'), ['RESET_ZOOM']], + [t('KeyboardShortcutPrompt.Zoom In'), ['ZOOM_IN']], + [t('KeyboardShortcutPrompt.Zoom Out'), ['ZOOM_OUT']], + [t('KeyboardShortcutPrompt.Focus Search'), ['FOCUS_SEARCH']], + [t('KeyboardShortcutPrompt.Search in New Window'), ['SEARCH_IN_NEW_WINDOW']], + + [t('KeyboardShortcutPrompt.Refresh'), ['REFRESH']], + [t('KeyboardShortcutPrompt.Focus Secondary Search'), ['FOCUS_SECONDARY_SEARCH']], + + [t('KeyboardShortcutPrompt.Captions'), ['CAPTIONS']], + [t('KeyboardShortcutPrompt.Theatre Mode'), ['THEATRE_MODE']], + [t('KeyboardShortcutPrompt.Fullscreen'), ['FULLSCREEN']], + [t('KeyboardShortcutPrompt.Full Window'), ['FULLWINDOW']], + [t('KeyboardShortcutPrompt.Picture in Picture'), ['PICTURE_IN_PICTURE']], + [t('KeyboardShortcutPrompt.Mute'), ['MUTE']], + [t('KeyboardShortcutPrompt.Volume Up'), ['VOLUME_UP']], + [t('KeyboardShortcutPrompt.Volume Down'), ['VOLUME_DOWN']], + [t('KeyboardShortcutPrompt.Take Screenshot'), ['TAKE_SCREENSHOT']], + [t('KeyboardShortcutPrompt.Stats'), ['STATS']], + + [t('KeyboardShortcutPrompt.Play'), ['PLAY']], + [t('KeyboardShortcutPrompt.Large Rewind'), ['LARGE_REWIND']], + [t('KeyboardShortcutPrompt.Large Fast Forward'), ['LARGE_FAST_FORWARD']], + [t('KeyboardShortcutPrompt.Small Rewind'), ['SMALL_REWIND']], + [t('KeyboardShortcutPrompt.Small Fast Forward'), ['SMALL_FAST_FORWARD']], + [t('KeyboardShortcutPrompt.Decrease Video Speed'), ['DECREASE_VIDEO_SPEED']], + [t('KeyboardShortcutPrompt.Increase Video Speed'), ['INCREASE_VIDEO_SPEED']], + [t('KeyboardShortcutPrompt.Skip by Tenths'), ['SKIP_N_TENTHS']], + [t('KeyboardShortcutPrompt.Last Chapter'), ['LAST_CHAPTER']], + [t('KeyboardShortcutPrompt.Next Chapter'), ['NEXT_CHAPTER']], + [t('KeyboardShortcutPrompt.Last Frame'), ['LAST_FRAME']], + [t('KeyboardShortcutPrompt.Next Frame'), ['NEXT_FRAME']], ]) }) @@ -176,15 +172,16 @@ function hideKeyboardShortcutPrompt() { } function getLocalizedShortcutNamesAndValues(dictionary) { - const localizedDictionary = localizedShortcutNameDictionary.value - return Object.entries(dictionary) - .filter(([key]) => - localizedDictionary.has(key) + const shortcutNameToShortcutsMap = localizedShortcutNameToShortcutsMap.value + const shortcutLabelSeparator = t('shortcutLabelSeparator') + + return shortcutNameToShortcutsMap.entries() + .filter(([_localizedShortcutName, shortcutCodes]) => + shortcutCodes.some(shortcutCode => Object.hasOwn(dictionary, shortcutCode)) ) - .map(([shortcutNameKey, shortcut]) => { - const localizedShortcutName = localizedDictionary.get(shortcutNameKey) - const localizedShortcut = getLocalizedShortcut(shortcut) - return [localizedShortcutName, localizedShortcut] + .map(([localizedShortcutName, shortcutCodes]) => { + const localizedShortcuts = shortcutCodes.map(code => getLocalizedShortcut(dictionary[code])) + return [localizedShortcutName, localizedShortcuts.join(shortcutLabelSeparator)] }) } From 7a81b13f3219137d7a05990a157065753e69e64c Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Sat, 4 Jan 2025 10:18:56 +0800 Subject: [PATCH 5/5] * Remove duplicate entry, use array not map, remove unused locale entries, update shortcut separator --- .../FtKeyboardShortcutPrompt.vue | 11 +++++------ static/locales/en-US.yaml | 4 +--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/renderer/components/FtKeyboardShortcutPrompt/FtKeyboardShortcutPrompt.vue b/src/renderer/components/FtKeyboardShortcutPrompt/FtKeyboardShortcutPrompt.vue index 21df78627bf10..7e5a91915226e 100644 --- a/src/renderer/components/FtKeyboardShortcutPrompt/FtKeyboardShortcutPrompt.vue +++ b/src/renderer/components/FtKeyboardShortcutPrompt/FtKeyboardShortcutPrompt.vue @@ -110,8 +110,8 @@ const primarySections = computed(() => [ const isMac = process.platform === 'darwin' -const localizedShortcutNameToShortcutsMap = computed(() => { - return new Map([ +const localizedShortcutNameToShortcutsMappings = computed(() => { + return [ [t('KeyboardShortcutPrompt.Show Keyboard Shortcuts'), ['SHOW_SHORTCUTS']], [t('KeyboardShortcutPrompt.History Backward'), [ 'HISTORY_BACKWARD', @@ -121,7 +121,6 @@ const localizedShortcutNameToShortcutsMap = computed(() => { 'HISTORY_FORWARD', ...isMac ? ['HISTORY_FORWARD_ALT_MAC'] : [], ]], - [t('KeyboardShortcutPrompt.Fullscreen'), ['FULLSCREEN']], [t('KeyboardShortcutPrompt.Navigate to Settings'), ['NAVIGATE_TO_SETTINGS']], [t('KeyboardShortcutPrompt.Navigate to History'), [ isMac ? 'NAVIGATE_TO_HISTORY_MAC' : 'NAVIGATE_TO_HISTORY', @@ -164,7 +163,7 @@ const localizedShortcutNameToShortcutsMap = computed(() => { [t('KeyboardShortcutPrompt.Next Chapter'), ['NEXT_CHAPTER']], [t('KeyboardShortcutPrompt.Last Frame'), ['LAST_FRAME']], [t('KeyboardShortcutPrompt.Next Frame'), ['NEXT_FRAME']], - ]) + ] }) function hideKeyboardShortcutPrompt() { @@ -172,10 +171,10 @@ function hideKeyboardShortcutPrompt() { } function getLocalizedShortcutNamesAndValues(dictionary) { - const shortcutNameToShortcutsMap = localizedShortcutNameToShortcutsMap.value + const shortcutNameToShortcutsMappings = localizedShortcutNameToShortcutsMappings.value const shortcutLabelSeparator = t('shortcutLabelSeparator') - return shortcutNameToShortcutsMap.entries() + return shortcutNameToShortcutsMappings .filter(([_localizedShortcutName, shortcutCodes]) => shortcutCodes.some(shortcutCode => Object.hasOwn(dictionary, shortcutCode)) ) diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml index 6acabfca1c3c5..e08814392fc13 100644 --- a/static/locales/en-US.yaml +++ b/static/locales/en-US.yaml @@ -1124,7 +1124,7 @@ checkmark: ✓ Display Label: '{label}: {value}' KeyboardShortcutTemplate: '{label} ({shortcut})' shortcutJoinOperator: + -shortcutLabelSeparator: / +shortcutLabelSeparator: '|' Keys: alt: Alt ctrl: Ctrl @@ -1147,8 +1147,6 @@ KeyboardShortcutPrompt: Show Keyboard Shortcuts: Show keyboard shortcuts History Backward: Go back one page History Forward: Go forward one page - History Backward (Mac only): Go back one page (Mac only) - History Forward (Mac only): Go forward one page (Mac only) New Window: Create a new window Navigate to Settings: Navigate to the Settings page Navigate to History: Navigate to the History page