[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:
Chenlei Hu
2024-12-07 18:25:40 -08:00
committed by GitHub
parent a0ff78dbdb
commit a76159e9a0
7 changed files with 246 additions and 4 deletions

View File

@@ -8,4 +8,8 @@ module.exports = defineConfig({
entryLocale: 'en',
output: 'src/locales',
outputLocales: ['zh', 'ru', 'ja'],
reference: `Keep following model names untranslated:
- flux
- photomaker
`
});

View File

@@ -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

View File

@@ -1557,5 +1557,61 @@
"WebcamCapture": {
"display_name": "Webcam Capture"
}
},
"nodeCategories": {
"sampling": "sampling",
"loaders": "loaders",
"conditioning": "conditioning",
"latent": "latent",
"inpaint": "inpaint",
"batch": "batch",
"image": "image",
"mask": "mask",
"upscaling": "upscaling",
"_for_testing": "_for_testing",
"transform": "transform",
"advanced": "advanced",
"style_model": "style_model",
"controlnet": "controlnet",
"gligen": "gligen",
"deprecated": "deprecated",
"operations": "operations",
"postprocessing": "postprocessing",
"compositing": "compositing",
"model_merging": "model_merging",
"model_patches": "model_patches",
"unet": "unet",
"preprocessors": "preprocessors",
"custom_sampling": "custom_sampling",
"schedulers": "schedulers",
"samplers": "samplers",
"sigmas": "sigmas",
"guiders": "guiders",
"noise": "noise",
"model": "model",
"animation": "animation",
"video_models": "video_models",
"3d_models": "3d_models",
"upscale_diffusion": "upscale_diffusion",
"photomaker": "photomaker",
"stable_cascade": "stable_cascade",
"instructpix2pix": "instructpix2pix",
"model_specific": "model_specific",
"attention_experiments": "attention_experiments",
"audio": "audio",
"sd3": "sd3",
"guidance": "guidance",
"flux": "flux",
"video": "video",
"ltxv": "ltxv",
"hooks": "hooks",
"create": "create",
"scheduling": "scheduling",
"combine": "combine",
"cond single": "cond single",
"cond pair": "cond pair",
"clip": "clip",
"DevTools": "DevTools",
"api": "api"
}
}

View File

@@ -197,6 +197,62 @@
"noTasksFound": "タスクが見つかりませんでした",
"noTasksFoundMessage": "キューにタスクがありません。",
"noWorkflowsFound": "ワークフローが見つかりませんでした。",
"nodeCategories": {
"3d_models": "3Dモデル",
"DevTools": "デブツール",
"_for_testing": "_テスト用",
"advanced": "高度な",
"animation": "アニメーション",
"api": "API",
"attention_experiments": "アテンション実験",
"audio": "オーディオ",
"batch": "バッチ",
"clip": "クリップ",
"combine": "結合",
"compositing": "合成",
"cond pair": "条件ペア",
"cond single": "条件単体",
"conditioning": "条件付け",
"controlnet": "コントロールネット",
"create": "作成",
"custom_sampling": "カスタムサンプリング",
"deprecated": "非推奨",
"flux": "flux",
"gligen": "グライジェン",
"guidance": "ガイダンス",
"guiders": "ガイダー",
"hooks": "フック",
"image": "画像",
"inpaint": "インペイント",
"instructpix2pix": "インストラクションピクス2ピクス",
"latent": "潜在",
"loaders": "ローダー",
"ltxv": "LTXV",
"mask": "マスク",
"model": "モデル",
"model_merging": "モデルマージ",
"model_patches": "モデルパッチ",
"model_specific": "モデル特有",
"noise": "ノイズ",
"operations": "操作",
"photomaker": "photomaker",
"postprocessing": "ポストプロセッシング",
"preprocessors": "前処理",
"samplers": "サンプラー",
"sampling": "サンプリング",
"schedulers": "スケジューラー",
"scheduling": "スケジューリング",
"sd3": "SD3",
"sigmas": "シグマ",
"stable_cascade": "安定したカスケード",
"style_model": "スタイルモデル",
"transform": "変換",
"unet": "U-Net",
"upscale_diffusion": "アップスケール拡散",
"upscaling": "アップスケーリング",
"video": "ビデオ",
"video_models": "ビデオモデル"
},
"nodeDefs": {
"AddNoise": {
"display_name": "ノイズを追加"

View File

@@ -197,6 +197,62 @@
"noTasksFound": "Задачи не найдены",
"noTasksFoundMessage": "В очереди нет задач.",
"noWorkflowsFound": "Рабочие процессы не найдены.",
"nodeCategories": {
"3d_models": "3d_модели",
"DevTools": "Инструменты_разработчика",
"_for_testing": "_для_тестирования",
"advanced": "расширенный",
"animation": "анимация",
"api": "api",
"attention_experiments": "эксперименты_внимания",
"audio": "аудио",
"batch": "пакет",
"clip": "клип",
"combine": "объединить",
"compositing": "композитинг",
"cond pair": "условие_пара",
"cond single": "условие_одиночное",
"conditioning": "условие",
"controlnet": онтрольная_сеть",
"create": "создать",
"custom_sampling": "пользовательская_выборка",
"deprecated": "устаревший",
"flux": "flux",
"gligen": "глиген",
"guidance": "направление",
"guiders": "направляющие",
"hooks": "хуки",
"image": "изображение",
"inpaint": "восстановление",
"instructpix2pix": "инструктпикс2пикс",
"latent": "латентный",
"loaders": "загрузчики",
"ltxv": "ltxv",
"mask": "маска",
"model": "модель",
"model_merging": "слияниеоделей",
"model_patches": "патчи_моделей",
"model_specific": "специфичная_модель",
"noise": "шум",
"operations": "операции",
"photomaker": "photomaker",
"postprocessing": "постобработка",
"preprocessors": "предобработчики",
"samplers": "семплеры",
"sampling": "выборка",
"schedulers": "планировщики",
"scheduling": "планирование",
"sd3": "sd3",
"sigmas": "сигмы",
"stable_cascade": "стабильная_каскадная",
"style_model": одель_стиля",
"transform": "преобразование",
"unet": "унет",
"upscale_diffusion": "увеличение_диффузии",
"upscaling": "увеличение",
"video": "видео",
"video_models": "видеомодели"
},
"nodeDefs": {
"AddNoise": {
"display_name": "Добавить шум"

View File

@@ -197,6 +197,62 @@
"noTasksFound": "未找到任务",
"noTasksFoundMessage": "队列中没有任务。",
"noWorkflowsFound": "未找到工作流",
"nodeCategories": {
"3d_models": "3D模型",
"DevTools": "开发工具",
"_for_testing": "_用于测试",
"advanced": "高级",
"animation": "动画",
"api": "API",
"attention_experiments": "注意力实验",
"audio": "音频",
"batch": "批处理",
"clip": "剪辑",
"combine": "组合",
"compositing": "合成",
"cond pair": "条件对",
"cond single": "条件单个",
"conditioning": "条件处理",
"controlnet": "控制网络",
"create": "创建",
"custom_sampling": "自定义采样",
"deprecated": "已弃用",
"flux": "flux",
"gligen": "生成",
"guidance": "引导",
"guiders": "引导器",
"hooks": "钩子",
"image": "图像",
"inpaint": "修复",
"instructpix2pix": "指令图像到图像",
"latent": "潜在",
"loaders": "加载器",
"ltxv": "LTXV",
"mask": "掩码",
"model": "模型",
"model_merging": "模型合并",
"model_patches": "模型补丁",
"model_specific": "模型特定",
"noise": "噪声",
"operations": "操作",
"photomaker": "photomaker",
"postprocessing": "后处理",
"preprocessors": "预处理器",
"samplers": "采样器",
"sampling": "采样",
"schedulers": "调度器",
"scheduling": "调度",
"sd3": "SD3",
"sigmas": "西格玛",
"stable_cascade": "稳定级联",
"style_model": "风格模型",
"transform": "变换",
"unet": "U-Net",
"upscale_diffusion": "放大扩散",
"upscaling": "放大",
"video": "视频",
"video_models": "视频模型"
},
"nodeDefs": {
"AddNoise": {
"display_name": "添加噪声"

View File

@@ -1833,7 +1833,11 @@ export class ComfyApp {
),
description: def.description
? st(`nodeDefs.${name}.description`, def.description)
: undefined
: undefined,
category: def.category
.split('/')
.map((category) => st(`nodeCategories.${category}`, category))
.join('/')
}
])
)