From 8103e606c48ed9d73e05a51c4112138fb8102e3d Mon Sep 17 00:00:00 2001 From: Charlie Calendre <57274151+c-cal@users.noreply.github.com> Date: Thu, 10 Feb 2022 10:11:35 +0100 Subject: [PATCH] Fix translation for keyboard shortcut displaynames (#7758) --- .../views/settings/tabs/user/KeyboardUserSettingsTab.tsx | 3 ++- .../__snapshots__/KeyboardUserSettingsTab-test.tsx.snap | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/views/settings/tabs/user/KeyboardUserSettingsTab.tsx b/src/components/views/settings/tabs/user/KeyboardUserSettingsTab.tsx index 29a4060a9c..0efb11fd6c 100644 --- a/src/components/views/settings/tabs/user/KeyboardUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/KeyboardUserSettingsTab.tsx @@ -35,7 +35,8 @@ const getKeyboardShortcutValue = (name: string) => { }; const getKeyboardShortcutDisplayName = (name: string): string => { - return getKeyboardShortcuts()[name]?.displayName as string; + const keyboardShortcutDisplayName = getKeyboardShortcuts()[name]?.displayName as string; + return keyboardShortcutDisplayName && _t(keyboardShortcutDisplayName); }; interface IKeyboardKeyProps { diff --git a/test/components/views/settings/tabs/user/__snapshots__/KeyboardUserSettingsTab-test.tsx.snap b/test/components/views/settings/tabs/user/__snapshots__/KeyboardUserSettingsTab-test.tsx.snap index ab0a3b8eb3..99a97a72d0 100644 --- a/test/components/views/settings/tabs/user/__snapshots__/KeyboardUserSettingsTab-test.tsx.snap +++ b/test/components/views/settings/tabs/user/__snapshots__/KeyboardUserSettingsTab-test.tsx.snap @@ -140,7 +140,7 @@ exports[`KeyboardUserSettingsTab renders list of keyboard shortcuts 1`] = `
- Cancel replying to a message + missing translation: en|Cancel replying to a message @@ -177,7 +177,7 @@ exports[`KeyboardUserSettingsTab renders list of keyboard shortcuts 1`] = `
- Toggle Bold + missing translation: en|Toggle Bold @@ -241,7 +241,7 @@ exports[`KeyboardUserSettingsTab renders list of keyboard shortcuts 1`] = `
- Select room from the room list + missing translation: en|Select room from the room list