Skip to content

Commit f98443d

Browse files
Translated Keyboard Shortcuts (#5007) (#5012)
* fix: Update command label rendering to use i18n normalization * fix: Replace deprecated with t for command label rendering * fix: Simplify command rendering check in ShortcutsList tests * fix: Add missing translation for command label in ShortcutsList tests Co-authored-by: Johnpaul Chiwetelu <[email protected]>
1 parent 1094b57 commit f98443d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/components/bottomPanel/tabs/shortcuts/ShortcutsList.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
>
2121
<div class="shortcut-info flex-grow pr-4">
2222
<div class="shortcut-name text-sm font-medium">
23-
{{ command.label || command.id }}
23+
{{ t(`commands.${normalizeI18nKey(command.id)}.label`) }}
2424
</div>
2525
</div>
2626

@@ -50,6 +50,7 @@ import { computed } from 'vue'
5050
import { useI18n } from 'vue-i18n'
5151
5252
import type { ComfyCommandImpl } from '@/stores/commandStore'
53+
import { normalizeI18nKey } from '@/utils/formatUtil'
5354
5455
const { t } = useI18n()
5556

tests-ui/tests/components/bottomPanel/ShortcutsList.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const mockT = vi.fn((key: string) => {
1111
'shortcuts.subcategories.node': 'Node',
1212
'shortcuts.subcategories.queue': 'Queue',
1313
'shortcuts.subcategories.view': 'View',
14-
'shortcuts.subcategories.panelControls': 'Panel Controls'
14+
'shortcuts.subcategories.panelControls': 'Panel Controls',
15+
'commands.Workflow_New.label': 'New Blank Workflow'
1516
}
1617
return translations[key] || key
1718
})
@@ -76,9 +77,7 @@ describe('ShortcutsList', () => {
7677
expect(wrapper.text()).toContain('Queue')
7778

7879
// Check that commands are rendered
79-
expect(wrapper.text()).toContain('New Workflow')
80-
expect(wrapper.text()).toContain('Add Node')
81-
expect(wrapper.text()).toContain('Clear Queue')
80+
expect(wrapper.text()).toContain('New Blank Workflow')
8281
})
8382

8483
it('should format keyboard shortcuts correctly', () => {

0 commit comments

Comments
 (0)