mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-12 16:40:05 +00:00
[i18n] Translate node categories (#1842)
* [i18n] Translate node categories * nit * Update locales [skip ci] * Fix some translations * Do translate --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import { formatCamelCase, normalizeI18nKey } from '../src/utils/formatUtil'
|
||||
import type { ComfyCommandImpl } from '../src/stores/commandStore'
|
||||
import type { FormItem, SettingParams } from '../src/types/settingTypes'
|
||||
import type { ComfyApi } from '../src/scripts/api'
|
||||
import type { ComfyNodeDef } from '../src/types/apiTypes'
|
||||
|
||||
const localePath = './src/locales/en.json'
|
||||
const extractMenuCommandLocaleStrings = (): Set<string> => {
|
||||
@@ -97,10 +98,10 @@ test('collect-i18n', async ({ comfyPage }) => {
|
||||
)
|
||||
|
||||
// Node Definitions
|
||||
const nodeDefs = await comfyPage.page.evaluate(async () => {
|
||||
const nodeDefs = (await comfyPage.page.evaluate(async () => {
|
||||
const api = window['app'].api as ComfyApi
|
||||
return await api.getNodeDefs()
|
||||
})
|
||||
})) as Record<string, ComfyNodeDef>
|
||||
|
||||
const allNodeDefsLocale = Object.fromEntries(
|
||||
Object.values(nodeDefs)
|
||||
@@ -114,6 +115,14 @@ test('collect-i18n', async ({ comfyPage }) => {
|
||||
])
|
||||
)
|
||||
|
||||
const allNodeCategoriesLocale = Object.fromEntries(
|
||||
Object.values(nodeDefs).flatMap((nodeDef) =>
|
||||
nodeDef.category
|
||||
.split('/')
|
||||
.map((category) => [normalizeI18nKey(category), category])
|
||||
)
|
||||
)
|
||||
|
||||
fs.writeFileSync(
|
||||
localePath,
|
||||
JSON.stringify(
|
||||
@@ -129,7 +138,8 @@ test('collect-i18n', async ({ comfyPage }) => {
|
||||
},
|
||||
serverConfigItems: allServerConfigsLocale,
|
||||
serverConfigCategories: allServerConfigCategoriesLocale,
|
||||
nodeDefs: allNodeDefsLocale
|
||||
nodeDefs: allNodeDefsLocale,
|
||||
nodeCategories: allNodeCategoriesLocale
|
||||
},
|
||||
null,
|
||||
2
|
||||
|
||||
Reference in New Issue
Block a user