Skip to content

Commit

Permalink
[i18n] Collect node data types (#1859)
Browse files Browse the repository at this point in the history
* [i18n] Collect node data types

* nit

* Update locales [skip ci]

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
huchenlei and github-actions authored Dec 10, 2024
1 parent 112a693 commit 86797d2
Show file tree
Hide file tree
Showing 7 changed files with 190 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .i18nrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ module.exports = defineConfig({
reference: `Keep following model names untranslated:
- flux
- photomaker
- clip
- vae
`
});
28 changes: 28 additions & 0 deletions scripts/collect-i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -152,6 +179,7 @@ test('collect-i18n', async ({ comfyPage }) => {
serverConfigItems: allServerConfigsLocale,
serverConfigCategories: allServerConfigCategoriesLocale,
nodeDefs: allNodeDefsLocale,
dataTypes: allDataTypesLocale,
nodeCategories: allNodeCategoriesLocale
},
null,
Expand Down
32 changes: 32 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
32 changes: 32 additions & 0 deletions src/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "再インストール"
Expand Down
32 changes: 32 additions & 0 deletions src/locales/ko.json
Original file line number Diff line number Diff line change
@@ -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": "재설치"
Expand Down
32 changes: 32 additions & 0 deletions src/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "Переустановить"
Expand Down
32 changes: 32 additions & 0 deletions src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "重新安装"
Expand Down

0 comments on commit 86797d2

Please sign in to comment.