@@ -113,73 +113,77 @@ const primarySections = computed(() => [
113
113
114
114
const isMac = process .platform === ' darwin'
115
115
116
- const localizedShortcutNameDictionary = computed (() => {
117
- return new Map ([
118
- [' SHOW_SHORTCUTS' , t (' KeyboardShortcutPrompt.Show Keyboard Shortcuts' )],
119
- [' HISTORY_BACKWARD' , t (' KeyboardShortcutPrompt.History Backward' )],
120
- [' HISTORY_FORWARD' , t (' KeyboardShortcutPrompt.History Forward' )],
121
- [' FULLSCREEN' , t (' KeyboardShortcutPrompt.Fullscreen' )],
122
- [' NAVIGATE_TO_SETTINGS' , t (' KeyboardShortcutPrompt.Navigate to Settings' )],
123
- (
124
- isMac
125
- ? [' NAVIGATE_TO_HISTORY_MAC' , t (' KeyboardShortcutPrompt.Navigate to History' )]
126
- : [' NAVIGATE_TO_HISTORY' , t (' KeyboardShortcutPrompt.Navigate to History' )]
127
- ),
128
- [' NEW_WINDOW' , t (' KeyboardShortcutPrompt.New Window' )],
129
- [' MINIMIZE_WINDOW' , t (' KeyboardShortcutPrompt.Minimize Window' )],
130
- [' CLOSE_WINDOW' , t (' KeyboardShortcutPrompt.Close Window' )],
131
- [' RESTART_WINDOW' , t (' KeyboardShortcutPrompt.Restart Window' )],
132
- [' FORCE_RESTART_WINDOW' , t (' KeyboardShortcutPrompt.Force Restart Window' )],
133
- [' TOGGLE_DEVTOOLS' , t (' KeyboardShortcutPrompt.Toggle Developer Tools' )],
134
- [' RESET_ZOOM' , t (' KeyboardShortcutPrompt.Reset Zoom' )],
135
- [' ZOOM_IN' , t (' KeyboardShortcutPrompt.Zoom In' )],
136
- [' ZOOM_OUT' , t (' KeyboardShortcutPrompt.Zoom Out' )],
137
- [' FOCUS_SEARCH' , t (' KeyboardShortcutPrompt.Focus Search' )],
138
- [' SEARCH_IN_NEW_WINDOW' , t (' KeyboardShortcutPrompt.Search in New Window' )],
139
-
140
- [' REFRESH' , t (' KeyboardShortcutPrompt.Refresh' )],
141
- [' FOCUS_SECONDARY_SEARCH' , t (' KeyboardShortcutPrompt.Focus Secondary Search' )],
142
-
143
- [' CAPTIONS' , t (' KeyboardShortcutPrompt.Captions' )],
144
- [' THEATRE_MODE' , t (' KeyboardShortcutPrompt.Theatre Mode' )],
145
- [' FULLSCREEN' , t (' KeyboardShortcutPrompt.Fullscreen' )],
146
- [' FULLWINDOW' , t (' KeyboardShortcutPrompt.Full Window' )],
147
- [' PICTURE_IN_PICTURE' , t (' KeyboardShortcutPrompt.Picture in Picture' )],
148
- [' MUTE' , t (' KeyboardShortcutPrompt.Mute' )],
149
- [' VOLUME_UP' , t (' KeyboardShortcutPrompt.Volume Up' )],
150
- [' VOLUME_DOWN' , t (' KeyboardShortcutPrompt.Volume Down' )],
151
- [' TAKE_SCREENSHOT' , t (' KeyboardShortcutPrompt.Take Screenshot' )],
152
- [' STATS' , t (' KeyboardShortcutPrompt.Stats' )],
153
-
154
- [' PLAY' , t (' KeyboardShortcutPrompt.Play' )],
155
- [' LARGE_REWIND' , t (' KeyboardShortcutPrompt.Large Rewind' )],
156
- [' LARGE_FAST_FORWARD' , t (' KeyboardShortcutPrompt.Large Fast Forward' )],
157
- [' SMALL_REWIND' , t (' KeyboardShortcutPrompt.Small Rewind' )],
158
- [' SMALL_FAST_FORWARD' , t (' KeyboardShortcutPrompt.Small Fast Forward' )],
159
- [' DECREASE_VIDEO_SPEED' , t (' KeyboardShortcutPrompt.Decrease Video Speed' )],
160
- [' INCREASE_VIDEO_SPEED' , t (' KeyboardShortcutPrompt.Increase Video Speed' )],
161
- [' SKIP_N_TENTHS' , t (' KeyboardShortcutPrompt.Skip by Tenths' )],
162
- [' LAST_CHAPTER' , t (' KeyboardShortcutPrompt.Last Chapter' )],
163
- [' NEXT_CHAPTER' , t (' KeyboardShortcutPrompt.Next Chapter' )],
164
- [' LAST_FRAME' , t (' KeyboardShortcutPrompt.Last Frame' )],
165
- [' NEXT_FRAME' , t (' KeyboardShortcutPrompt.Next Frame' )],
166
- ])
116
+ const localizedShortcutNameToShortcutsMappings = computed (() => {
117
+ return [
118
+ [t (' KeyboardShortcutPrompt.Show Keyboard Shortcuts' ), [' SHOW_SHORTCUTS' ]],
119
+ [t (' KeyboardShortcutPrompt.History Backward' ), [
120
+ ' HISTORY_BACKWARD' ,
121
+ ... isMac ? [' HISTORY_BACKWARD_ALT_MAC' ] : [],
122
+ ]],
123
+ [t (' KeyboardShortcutPrompt.History Forward' ), [
124
+ ' HISTORY_FORWARD' ,
125
+ ... isMac ? [' HISTORY_FORWARD_ALT_MAC' ] : [],
126
+ ]],
127
+ [t (' KeyboardShortcutPrompt.Navigate to Settings' ), [' NAVIGATE_TO_SETTINGS' ]],
128
+ [t (' KeyboardShortcutPrompt.Navigate to History' ), [
129
+ isMac ? ' NAVIGATE_TO_HISTORY_MAC' : ' NAVIGATE_TO_HISTORY' ,
130
+ ]],
131
+ [t (' KeyboardShortcutPrompt.New Window' ), [' NEW_WINDOW' ]],
132
+ [t (' KeyboardShortcutPrompt.Minimize Window' ), [' MINIMIZE_WINDOW' ]],
133
+ [t (' KeyboardShortcutPrompt.Close Window' ), [' CLOSE_WINDOW' ]],
134
+ [t (' KeyboardShortcutPrompt.Restart Window' ), [' RESTART_WINDOW' ]],
135
+ [t (' KeyboardShortcutPrompt.Force Restart Window' ), [' FORCE_RESTART_WINDOW' ]],
136
+ [t (' KeyboardShortcutPrompt.Toggle Developer Tools' ), [' TOGGLE_DEVTOOLS' ]],
137
+ [t (' KeyboardShortcutPrompt.Reset Zoom' ), [' RESET_ZOOM' ]],
138
+ [t (' KeyboardShortcutPrompt.Zoom In' ), [' ZOOM_IN' ]],
139
+ [t (' KeyboardShortcutPrompt.Zoom Out' ), [' ZOOM_OUT' ]],
140
+ [t (' KeyboardShortcutPrompt.Focus Search' ), [' FOCUS_SEARCH' ]],
141
+ [t (' KeyboardShortcutPrompt.Search in New Window' ), [' SEARCH_IN_NEW_WINDOW' ]],
142
+
143
+ [t (' KeyboardShortcutPrompt.Refresh' ), [' REFRESH' ]],
144
+ [t (' KeyboardShortcutPrompt.Focus Secondary Search' ), [' FOCUS_SECONDARY_SEARCH' ]],
145
+
146
+ [t (' KeyboardShortcutPrompt.Captions' ), [' CAPTIONS' ]],
147
+ [t (' KeyboardShortcutPrompt.Theatre Mode' ), [' THEATRE_MODE' ]],
148
+ [t (' KeyboardShortcutPrompt.Fullscreen' ), [' FULLSCREEN' ]],
149
+ [t (' KeyboardShortcutPrompt.Full Window' ), [' FULLWINDOW' ]],
150
+ [t (' KeyboardShortcutPrompt.Picture in Picture' ), [' PICTURE_IN_PICTURE' ]],
151
+ [t (' KeyboardShortcutPrompt.Mute' ), [' MUTE' ]],
152
+ [t (' KeyboardShortcutPrompt.Volume Up' ), [' VOLUME_UP' ]],
153
+ [t (' KeyboardShortcutPrompt.Volume Down' ), [' VOLUME_DOWN' ]],
154
+ [t (' KeyboardShortcutPrompt.Take Screenshot' ), [' TAKE_SCREENSHOT' ]],
155
+ [t (' KeyboardShortcutPrompt.Stats' ), [' STATS' ]],
156
+
157
+ [t (' KeyboardShortcutPrompt.Play' ), [' PLAY' ]],
158
+ [t (' KeyboardShortcutPrompt.Large Rewind' ), [' LARGE_REWIND' ]],
159
+ [t (' KeyboardShortcutPrompt.Large Fast Forward' ), [' LARGE_FAST_FORWARD' ]],
160
+ [t (' KeyboardShortcutPrompt.Small Rewind' ), [' SMALL_REWIND' ]],
161
+ [t (' KeyboardShortcutPrompt.Small Fast Forward' ), [' SMALL_FAST_FORWARD' ]],
162
+ [t (' KeyboardShortcutPrompt.Decrease Video Speed' ), [' DECREASE_VIDEO_SPEED' ]],
163
+ [t (' KeyboardShortcutPrompt.Increase Video Speed' ), [' INCREASE_VIDEO_SPEED' ]],
164
+ [t (' KeyboardShortcutPrompt.Skip by Tenths' ), [' SKIP_N_TENTHS' ]],
165
+ [t (' KeyboardShortcutPrompt.Last Chapter' ), [' LAST_CHAPTER' ]],
166
+ [t (' KeyboardShortcutPrompt.Next Chapter' ), [' NEXT_CHAPTER' ]],
167
+ [t (' KeyboardShortcutPrompt.Last Frame' ), [' LAST_FRAME' ]],
168
+ [t (' KeyboardShortcutPrompt.Next Frame' ), [' NEXT_FRAME' ]],
169
+ ]
167
170
})
168
171
169
172
function hideKeyboardShortcutPrompt () {
170
173
store .dispatch (' hideKeyboardShortcutPrompt' )
171
174
}
172
175
173
176
function getLocalizedShortcutNamesAndValues (dictionary ) {
174
- const localizedDictionary = localizedShortcutNameDictionary .value
175
- return Object .entries (dictionary)
176
- .filter (([key ]) =>
177
- localizedDictionary .has (key)
177
+ const shortcutNameToShortcutsMappings = localizedShortcutNameToShortcutsMappings .value
178
+ const shortcutLabelSeparator = t (' shortcutLabelSeparator' )
179
+
180
+ return shortcutNameToShortcutsMappings
181
+ .filter (([_localizedShortcutName , shortcutCodes ]) =>
182
+ shortcutCodes .some (shortcutCode => Object .hasOwn (dictionary, shortcutCode))
178
183
)
179
- .map (([shortcutNameKey , shortcut ]) => {
180
- const localizedShortcutName = localizedDictionary .get (shortcutNameKey)
181
- const localizedShortcut = getLocalizedShortcut (shortcut)
182
- return [localizedShortcutName, localizedShortcut]
184
+ .map (([localizedShortcutName , shortcutCodes ]) => {
185
+ const localizedShortcuts = shortcutCodes .map (code => getLocalizedShortcut (dictionary[code]))
186
+ return [localizedShortcutName, localizedShortcuts .join (shortcutLabelSeparator)]
183
187
})
184
188
}
185
189
0 commit comments