mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-09 15:10:17 +00:00
Translate command label on top command dropdown menu (#1792)
* collect i18n with playwright * Add command label translation * Normalize i18n object key
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useMenuItemStore } from '@/stores/menuItemStore'
|
||||
import { useSettingStore } from '@/stores/settingStore'
|
||||
import { normalizeI18nKey } from '@/utils/formatUtil'
|
||||
import Menubar from 'primevue/menubar'
|
||||
import type { MenuItem } from 'primevue/menuitem'
|
||||
import { computed } from 'vue'
|
||||
@@ -44,11 +45,9 @@ const dropdownDirection = computed(() =>
|
||||
const menuItemsStore = useMenuItemStore()
|
||||
const { t } = useI18n()
|
||||
const translateMenuItem = (item: MenuItem): MenuItem => {
|
||||
const translatedLabel = item.label
|
||||
? t(
|
||||
`menuLabels.${item.label}`,
|
||||
typeof item.label === 'function' ? item.label() : item.label
|
||||
)
|
||||
const label = typeof item.label === 'function' ? item.label() : item.label
|
||||
const translatedLabel = label
|
||||
? t(`menuLabels.${normalizeI18nKey(label)}`, label)
|
||||
: undefined
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user