From 72994621a60bc5ef9eb58966849d3dffce60927b Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 9 Mar 2025 10:47:49 -0700 Subject: [PATCH] Translate template categories (#2937) Co-authored-by: github-actions --- .i18nrc.cjs | 2 +- src/locales/en/main.json | 14 ++++++++++++++ src/locales/fr/main.json | 14 ++++++++++++++ src/locales/ja/main.json | 14 ++++++++++++++ src/locales/ko/main.json | 14 ++++++++++++++ src/locales/ru/main.json | 14 ++++++++++++++ src/locales/zh/main.json | 14 ++++++++++++++ src/stores/workflowTemplatesStore.ts | 23 ++++++++++++++++++++--- 8 files changed, 105 insertions(+), 4 deletions(-) diff --git a/.i18nrc.cjs b/.i18nrc.cjs index 342b8800e..f5a9da81b 100644 --- a/.i18nrc.cjs +++ b/.i18nrc.cjs @@ -10,7 +10,7 @@ module.exports = defineConfig({ entryLocale: 'en', output: 'src/locales', outputLocales: ['zh', 'ru', 'ja', 'ko', 'fr'], - reference: `Special names to keep untranslated: flux, photomaker, clip, vae, cfg, stable audio, stable cascade. + reference: `Special names to keep untranslated: flux, photomaker, clip, vae, cfg, stable audio, stable cascade, controlnet, lora. 'latent' is the short form of 'latent space'. 'mask' is in the context of image processing. ` diff --git a/src/locales/en/main.json b/src/locales/en/main.json index aa501ebcd..8a7be2404 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -417,6 +417,20 @@ }, "templateWorkflows": { "title": "Get Started with a Template", + "category": { + "ComfyUI Examples": "ComfyUI Examples", + "Custom Nodes": "Custom Nodes", + "Basics": "Basics", + "Flux": "Flux", + "ControlNet": "ControlNet", + "Upscaling": "Upscaling", + "Video": "Video", + "SD3_5": "SD3.5", + "SDXL": "SDXL", + "Area Composition": "Area Composition", + "3D": "3D", + "Audio": "Audio" + }, "template": { "Flux": { "flux_dev_checkpoint_example": "Flux Dev", diff --git a/src/locales/fr/main.json b/src/locales/fr/main.json index fec33b431..b3aa3a544 100644 --- a/src/locales/fr/main.json +++ b/src/locales/fr/main.json @@ -826,6 +826,20 @@ "removeFromBookmarks": "Retirer des Favoris" }, "templateWorkflows": { + "category": { + "3D": "3D", + "Area Composition": "Composition de zone", + "Audio": "Audio", + "Basics": "Basiques", + "ComfyUI Examples": "Exemples ComfyUI", + "ControlNet": "ControlNet", + "Custom Nodes": "Nœuds personnalisés", + "Flux": "Flux", + "SD3_5": "SD3.5", + "SDXL": "SDXL", + "Upscaling": "Mise à l'échelle", + "Video": "Vidéo" + }, "template": { "3D": { "stable_zero123_example": "Stable Zero123" diff --git a/src/locales/ja/main.json b/src/locales/ja/main.json index d46639ae3..b12f8c61d 100644 --- a/src/locales/ja/main.json +++ b/src/locales/ja/main.json @@ -826,6 +826,20 @@ "removeFromBookmarks": "ブックマークから削除" }, "templateWorkflows": { + "category": { + "3D": "3D", + "Area Composition": "エリア構成", + "Audio": "オーディオ", + "Basics": "基本", + "ComfyUI Examples": "ComfyUIの例", + "ControlNet": "ControlNet", + "Custom Nodes": "カスタムノード", + "Flux": "Flux", + "SD3_5": "SD3.5", + "SDXL": "SDXL", + "Upscaling": "アップスケーリング", + "Video": "ビデオ" + }, "template": { "3D": { "stable_zero123_example": "Stable Zero123" diff --git a/src/locales/ko/main.json b/src/locales/ko/main.json index 6fd2ee810..95447e40a 100644 --- a/src/locales/ko/main.json +++ b/src/locales/ko/main.json @@ -826,6 +826,20 @@ "removeFromBookmarks": "북마크에서 제거" }, "templateWorkflows": { + "category": { + "3D": "3D", + "Area Composition": "영역 구성", + "Audio": "오디오", + "Basics": "기본", + "ComfyUI Examples": "ComfyUI 예시", + "ControlNet": "ControlNet", + "Custom Nodes": "사용자 정의 노드", + "Flux": "Flux", + "SD3_5": "SD3.5", + "SDXL": "SDXL", + "Upscaling": "업스케일링", + "Video": "비디오" + }, "template": { "3D": { "stable_zero123_example": "스테이블 제로123" diff --git a/src/locales/ru/main.json b/src/locales/ru/main.json index f0f80c18b..a01a106b7 100644 --- a/src/locales/ru/main.json +++ b/src/locales/ru/main.json @@ -826,6 +826,20 @@ "removeFromBookmarks": "Удалить из закладок" }, "templateWorkflows": { + "category": { + "3D": "3D", + "Area Composition": "Композиция области", + "Audio": "Аудио", + "Basics": "Основы", + "ComfyUI Examples": "Примеры ComfyUI", + "ControlNet": "ControlNet", + "Custom Nodes": "Пользовательские узлы", + "Flux": "Flux", + "SD3_5": "SD3.5", + "SDXL": "SDXL", + "Upscaling": "Увеличение разрешения", + "Video": "Видео" + }, "template": { "3D": { "stable_zero123_example": "Stable Zero123" diff --git a/src/locales/zh/main.json b/src/locales/zh/main.json index a8e5652ae..48ee1a33e 100644 --- a/src/locales/zh/main.json +++ b/src/locales/zh/main.json @@ -826,6 +826,20 @@ "removeFromBookmarks": "从书签中移除" }, "templateWorkflows": { + "category": { + "3D": "3D", + "Area Composition": "区域组成", + "Audio": "音频", + "Basics": "基础", + "ComfyUI Examples": "ComfyUI示例", + "ControlNet": "ControlNet", + "Custom Nodes": "自定义节点", + "Flux": "Flux", + "SD3_5": "SD3.5", + "SDXL": "SDXL", + "Upscaling": "放大", + "Video": "视频" + }, "template": { "3D": { "stable_zero123_example": "稳定Zero123" diff --git a/src/stores/workflowTemplatesStore.ts b/src/stores/workflowTemplatesStore.ts index f888077e0..1aa90838d 100644 --- a/src/stores/workflowTemplatesStore.ts +++ b/src/stores/workflowTemplatesStore.ts @@ -1,23 +1,34 @@ import { groupBy } from 'lodash' import { defineStore } from 'pinia' import { computed, ref, shallowRef } from 'vue' +import { useI18n } from 'vue-i18n' import { api } from '@/scripts/api' import type { TemplateGroup, WorkflowTemplates } from '@/types/workflowTemplateTypes' +import { normalizeI18nKey } from '@/utils/formatUtil' export const useWorkflowTemplatesStore = defineStore( 'workflowTemplates', () => { + const { t } = useI18n() const customTemplates = shallowRef<{ [moduleName: string]: string[] }>({}) const coreTemplates = shallowRef([]) const isLoaded = ref(false) const groupedTemplates = computed(() => { const allTemplates = [ - ...coreTemplates.value, + ...coreTemplates.value.map((template) => ({ + ...template, + title: t( + `templateWorkflows.category.${normalizeI18nKey(template.title)}`, + { + defaultValue: template.title + } + ) + })), ...Object.entries(customTemplates.value).map( ([moduleName, templates]) => ({ moduleName, @@ -33,8 +44,14 @@ export const useWorkflowTemplatesStore = defineStore( ] return Object.entries( - groupBy(allTemplates, (t) => - t.moduleName === 'default' ? 'ComfyUI Examples' : 'Custom Nodes' + groupBy(allTemplates, (template) => + template.moduleName === 'default' + ? t('templateWorkflows.category.ComfyUI Examples', { + defaultValue: 'ComfyUI Examples' + }) + : t('templateWorkflows.category.Custom Nodes', { + defaultValue: 'Custom Nodes' + }) ) ).map(([label, modules]) => ({ label, modules })) })