Skip to content

Commit

Permalink
Prevent creating new shortcut localization if Shaka localization key …
Browse files Browse the repository at this point in the history
…has no matching value
  • Loading branch information
kommunarr committed Oct 14, 2024
1 parent 42c3128 commit 6202ff7
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const shakaControlKeysToShortcuts = {
PICTURE_IN_PICTURE: KeyboardShortcuts.VIDEO_PLAYER.PICTURE_IN_PICTURE,
ENTER_PICTURE_IN_PICTURE: KeyboardShortcuts.VIDEO_PLAYER.PICTURE_IN_PICTURE,
EXIT_PICTURE_IN_PICTURE: KeyboardShortcuts.VIDEO_PLAYER.PICTURE_IN_PICTURE,
CAPTIONS: KeyboardShortcuts.VIDEO_PLAYER.CAPTIONS,
x: 'x',
FULL_SCREEN: KeyboardShortcuts.VIDEO_PLAYER.FULLSCREEN,
EXIT_FULL_SCREEN: KeyboardShortcuts.VIDEO_PLAYER.FULLSCREEN
}
Expand Down Expand Up @@ -1007,6 +1007,12 @@ export default defineComponent({
const shakaControlKeysToShortcutLocalizations = new Map()
Object.entries(shakaControlKeysToShortcuts).forEach(([shakaControlKey, shortcut]) => {
const originalLocalization = localization.resolve(shakaControlKey)
if (originalLocalization === '') {
// e.g., A Shaka localization key in shakaControlKeysToShortcuts has fallen out of date and need to be updated
console.error('Mising Shaka localization key "%s"', shakaControlKey)
return
}

const localizationWithShortcut = i18n.t('KeyboardShortcutTemplate', {
label: originalLocalization,
shortcut: shortcut
Expand Down

0 comments on commit 6202ff7

Please sign in to comment.