From 86797d249239c779de5827985ab21d2d0eba2f27 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Tue, 10 Dec 2024 11:29:54 -0800 Subject: [PATCH] [i18n] Collect node data types (#1859) * [i18n] Collect node data types * nit * Update locales [skip ci] --------- Co-authored-by: github-actions --- .i18nrc.cjs | 2 ++ scripts/collect-i18n.ts | 28 ++++++++++++++++++++++++++++ src/locales/en.json | 32 ++++++++++++++++++++++++++++++++ src/locales/ja.json | 32 ++++++++++++++++++++++++++++++++ src/locales/ko.json | 32 ++++++++++++++++++++++++++++++++ src/locales/ru.json | 32 ++++++++++++++++++++++++++++++++ src/locales/zh.json | 32 ++++++++++++++++++++++++++++++++ 7 files changed, 190 insertions(+) diff --git a/.i18nrc.cjs b/.i18nrc.cjs index 87b697ba9..2eb845ade 100644 --- a/.i18nrc.cjs +++ b/.i18nrc.cjs @@ -11,5 +11,7 @@ module.exports = defineConfig({ reference: `Keep following model names untranslated: - flux - photomaker + - clip + - vae ` }); diff --git a/scripts/collect-i18n.ts b/scripts/collect-i18n.ts index a72dc0c16..9473a7c2f 100644 --- a/scripts/collect-i18n.ts +++ b/scripts/collect-i18n.ts @@ -136,6 +136,33 @@ test('collect-i18n', async ({ comfyPage }) => { ) ) + const allDataTypesLocale = Object.fromEntries( + Object.values(nodeDefs).flatMap((nodeDef) => { + const inputs = nodeDef.input ?? {} + const requiredInputs = inputs.required ?? {} + const optionalInputs = inputs.optional ?? {} + const allInputs = { + ...requiredInputs, + ...optionalInputs + } + + const inputDataTypes = Object.values(allInputs).map((inputSpec) => { + const typeRaw = inputSpec[0] + const type = Array.isArray(typeRaw) ? 'COMBO' : typeRaw + return type + }) + const outputDataTypes = nodeDef.output ?? [] + const allDataTypes = [...inputDataTypes, ...outputDataTypes].flatMap( + (type: string) => type.split(',') + ) + + return allDataTypes.map((dataType) => [ + normalizeI18nKey(dataType), + dataType + ]) + }) + ) + fs.writeFileSync( localePath, JSON.stringify( @@ -152,6 +179,7 @@ test('collect-i18n', async ({ comfyPage }) => { serverConfigItems: allServerConfigsLocale, serverConfigCategories: allServerConfigCategoriesLocale, nodeDefs: allNodeDefsLocale, + dataTypes: allDataTypesLocale, nodeCategories: allNodeCategoriesLocale }, null, diff --git a/src/locales/en.json b/src/locales/en.json index dda086103..f9f0108bf 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1697,5 +1697,37 @@ "clip": "clip", "DevTools": "DevTools", "api": "api" + }, + "dataTypes": { + "MODEL": "MODEL", + "INT": "INT", + "FLOAT": "FLOAT", + "COMBO": "COMBO", + "CONDITIONING": "CONDITIONING", + "LATENT": "LATENT", + "CLIP": "CLIP", + "VAE": "VAE", + "STRING": "STRING", + "IMAGE": "IMAGE", + "MASK": "MASK", + "CLIP_VISION": "CLIP_VISION", + "CLIP_VISION_OUTPUT": "CLIP_VISION_OUTPUT", + "STYLE_MODEL": "STYLE_MODEL", + "CONTROL_NET": "CONTROL_NET", + "GLIGEN": "GLIGEN", + "BOOLEAN": "BOOLEAN", + "LATENT_OPERATION": "LATENT_OPERATION", + "UPSCALE_MODEL": "UPSCALE_MODEL", + "SAMPLER": "SAMPLER", + "SIGMAS": "SIGMAS", + "GUIDER": "GUIDER", + "NOISE": "NOISE", + "PHOTOMAKER": "PHOTOMAKER", + "WEBCAM": "WEBCAM", + "AUDIO": "AUDIO", + "HOOKS": "HOOKS", + "HOOK_KEYFRAMES": "HOOK_KEYFRAMES", + "FLOATS": "FLOATS", + "TIMESTEPS_RANGE": "TIMESTEPS_RANGE" } } \ No newline at end of file diff --git a/src/locales/ja.json b/src/locales/ja.json index 5327c31d1..f2dc0838f 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -8,6 +8,38 @@ "red": "赤", "yellow": "黄色" }, + "dataTypes": { + "AUDIO": "オーディオ", + "BOOLEAN": "ブール", + "CLIP": "CLIP", + "CLIP_VISION": "CLIP_VISION", + "CLIP_VISION_OUTPUT": "CLIP_VISION_OUTPUT", + "COMBO": "コンボ", + "CONDITIONING": "条件付け", + "CONTROL_NET": "コントロールネット", + "FLOAT": "浮動小数点", + "FLOATS": "浮動小数点数", + "GLIGEN": "GLIGEN", + "GUIDER": "ガイダー", + "HOOKS": "フック", + "HOOK_KEYFRAMES": "フックキーフレーム", + "IMAGE": "画像", + "INT": "整数", + "LATENT": "潜在", + "LATENT_OPERATION": "潜在操作", + "MASK": "マスク", + "MODEL": "モデル", + "NOISE": "ノイズ", + "PHOTOMAKER": "PHOTOMAKER", + "SAMPLER": "サンプラー", + "SIGMAS": "シグマ", + "STRING": "文字列", + "STYLE_MODEL": "スタイルモデル", + "TIMESTEPS_RANGE": "タイムステップ範囲", + "UPSCALE_MODEL": "アップスケールモデル", + "VAE": "VAE", + "WEBCAM": "ウェブカメラ" + }, "desktopMenu": { "confirmReinstall": "これにより、extra_models_config.yamlファイルがクリアされ、再インストールが開始されます。本当によろしいですか?", "reinstall": "再インストール" diff --git a/src/locales/ko.json b/src/locales/ko.json index eb69fb730..bb0385421 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -1,5 +1,37 @@ { "color": "색상", + "dataTypes": { + "AUDIO": "오디오", + "BOOLEAN": "부울", + "CLIP": "CLIP", + "CLIP_VISION": "CLIP_VISION", + "CLIP_VISION_OUTPUT": "CLIP_VISION_OUTPUT", + "COMBO": "조합", + "CONDITIONING": "조건부", + "CONTROL_NET": "제어 네트워크", + "FLOAT": "부동 소수점", + "FLOATS": "부동 소수점 배열", + "GLIGEN": "GLIGEN", + "GUIDER": "가이드", + "HOOKS": "후크", + "HOOK_KEYFRAMES": "후크 키프레임", + "IMAGE": "이미지", + "INT": "정수", + "LATENT": "잠재", + "LATENT_OPERATION": "잠재 연산", + "MASK": "마스크", + "MODEL": "모델", + "NOISE": "노이즈", + "PHOTOMAKER": "PHOTOMAKER", + "SAMPLER": "샘플러", + "SIGMAS": "시그마", + "STRING": "문자열", + "STYLE_MODEL": "스타일 모델", + "TIMESTEPS_RANGE": "타임스텝 범위", + "UPSCALE_MODEL": "업스케일 모델", + "VAE": "VAE", + "WEBCAM": "웹캠" + }, "desktopMenu": { "confirmReinstall": "이 작업은 extra_models_config.yaml 파일을 지우고 설치를 다시 시작합니다. 정말로 진행하시겠습니까?", "reinstall": "재설치" diff --git a/src/locales/ru.json b/src/locales/ru.json index 14576c28c..7bb95ba99 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -8,6 +8,38 @@ "red": "Красный", "yellow": "Желтый" }, + "dataTypes": { + "AUDIO": "AUDIO", + "BOOLEAN": "BOOLEAN", + "CLIP": "CLIP", + "CLIP_VISION": "CLIP_VISION", + "CLIP_VISION_OUTPUT": "CLIP_VISION_OUTPUT", + "COMBO": "COMBO", + "CONDITIONING": "CONDITIONING", + "CONTROL_NET": "CONTROL_NET", + "FLOAT": "FLOAT", + "FLOATS": "FLOATS", + "GLIGEN": "GLIGEN", + "GUIDER": "GUIDER", + "HOOKS": "HOOKS", + "HOOK_KEYFRAMES": "HOOK_KEYFRAMES", + "IMAGE": "IMAGE", + "INT": "INT", + "LATENT": "LATENT", + "LATENT_OPERATION": "LATENT_OPERATION", + "MASK": "MASK", + "MODEL": "MODEL", + "NOISE": "NOISE", + "PHOTOMAKER": "PHOTOMAKER", + "SAMPLER": "SAMPLER", + "SIGMAS": "SIGMAS", + "STRING": "STRING", + "STYLE_MODEL": "STYLE_MODEL", + "TIMESTEPS_RANGE": "TIMESTEPS_RANGE", + "UPSCALE_MODEL": "UPSCALE_MODEL", + "VAE": "VAE", + "WEBCAM": "WEBCAM" + }, "desktopMenu": { "confirmReinstall": "Это очистит ваш файл extra_models_config.yaml и начнет установку заново. Вы уверены?", "reinstall": "Переустановить" diff --git a/src/locales/zh.json b/src/locales/zh.json index f1bdc33a9..fee50dfd1 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -8,6 +8,38 @@ "red": "红色", "yellow": "黄色" }, + "dataTypes": { + "AUDIO": "音频", + "BOOLEAN": "布尔值", + "CLIP": "CLIP", + "CLIP_VISION": "CLIP视觉", + "CLIP_VISION_OUTPUT": "CLIP视觉输出", + "COMBO": "组合", + "CONDITIONING": "条件", + "CONTROL_NET": "控制网络", + "FLOAT": "浮点数", + "FLOATS": "浮点数", + "GLIGEN": "GLIGEN", + "GUIDER": "引导器", + "HOOKS": "钩子", + "HOOK_KEYFRAMES": "钩子关键帧", + "IMAGE": "图像", + "INT": "整数", + "LATENT": "潜在", + "LATENT_OPERATION": "潜在操作", + "MASK": "掩码", + "MODEL": "模型", + "NOISE": "噪声", + "PHOTOMAKER": "PHOTOMAKER", + "SAMPLER": "采样器", + "SIGMAS": "西格玛", + "STRING": "字符串", + "STYLE_MODEL": "风格模型", + "TIMESTEPS_RANGE": "时间步长范围", + "UPSCALE_MODEL": "放大模型", + "VAE": "VAE", + "WEBCAM": "网络摄像头" + }, "desktopMenu": { "confirmReinstall": "这将清除您的 extra_models_config.yaml 文件,并重新开始安装。您确定吗?", "reinstall": "重新安装"