From 2ed1704749903d59273d535c121af791962ff93c Mon Sep 17 00:00:00 2001
From: Johnpaul Chiwetelu <49923152+Myestery@users.noreply.github.com>
Date: Fri, 15 Aug 2025 19:45:10 +0100
Subject: [PATCH] Translated Keyboard Shortcuts (#5007)
* 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
---
.../bottomPanel/tabs/shortcuts/ShortcutsList.vue | 3 ++-
.../tests/components/bottomPanel/ShortcutsList.spec.ts | 7 +++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/components/bottomPanel/tabs/shortcuts/ShortcutsList.vue b/src/components/bottomPanel/tabs/shortcuts/ShortcutsList.vue
index 10f3c7b59..2a5e84f79 100644
--- a/src/components/bottomPanel/tabs/shortcuts/ShortcutsList.vue
+++ b/src/components/bottomPanel/tabs/shortcuts/ShortcutsList.vue
@@ -20,7 +20,7 @@
>
- {{ command.label || command.id }}
+ {{ t(`commands.${normalizeI18nKey(command.id)}.label`) }}
@@ -50,6 +50,7 @@ import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import type { ComfyCommandImpl } from '@/stores/commandStore'
+import { normalizeI18nKey } from '@/utils/formatUtil'
const { t } = useI18n()
diff --git a/tests-ui/tests/components/bottomPanel/ShortcutsList.spec.ts b/tests-ui/tests/components/bottomPanel/ShortcutsList.spec.ts
index d42e7250c..1ba43a9d2 100644
--- a/tests-ui/tests/components/bottomPanel/ShortcutsList.spec.ts
+++ b/tests-ui/tests/components/bottomPanel/ShortcutsList.spec.ts
@@ -11,7 +11,8 @@ const mockT = vi.fn((key: string) => {
'shortcuts.subcategories.node': 'Node',
'shortcuts.subcategories.queue': 'Queue',
'shortcuts.subcategories.view': 'View',
- 'shortcuts.subcategories.panelControls': 'Panel Controls'
+ 'shortcuts.subcategories.panelControls': 'Panel Controls',
+ 'commands.Workflow_New.label': 'New Blank Workflow'
}
return translations[key] || key
})
@@ -76,9 +77,7 @@ describe('ShortcutsList', () => {
expect(wrapper.text()).toContain('Queue')
// Check that commands are rendered
- expect(wrapper.text()).toContain('New Workflow')
- expect(wrapper.text()).toContain('Add Node')
- expect(wrapper.text()).toContain('Clear Queue')
+ expect(wrapper.text()).toContain('New Blank Workflow')
})
it('should format keyboard shortcuts correctly', () => {