diff --git a/.github/workflows/translate-i18n-claude.yml b/.github/workflows/translate-i18n-claude.yml index 8344af9890..5d9440ff35 100644 --- a/.github/workflows/translate-i18n-claude.yml +++ b/.github/workflows/translate-i18n-claude.yml @@ -134,6 +134,9 @@ jobs: with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} github_token: ${{ secrets.GITHUB_TOKEN }} + # Allow github-actions bot to trigger this workflow via repository_dispatch + # See: https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md + allowed_bots: 'github-actions[bot]' prompt: | You are a professional i18n synchronization engineer for the Dify project. Your task is to keep all language translations in sync with the English source (en-US). @@ -285,6 +288,22 @@ jobs: - `${variable}` - Template literal - `content` - HTML tags - `_one`, `_other` - Pluralization suffixes (these are KEY suffixes, not values) + + **CRITICAL: Variable names and tag names MUST stay in English - NEVER translate them** + + ✅ CORRECT examples: + - English: "{{count}} items" → Japanese: "{{count}} 個のアイテム" + - English: "{{name}} updated" → Korean: "{{name}} 업데이트됨" + - English: "{{email}}" → Chinese: "{{email}}" + - English: "Marketplace" → Japanese: "マーケットプレイス" + + ❌ WRONG examples (NEVER do this - will break the application): + - "{{count}}" → "{{カウント}}" ❌ (variable name translated to Japanese) + - "{{name}}" → "{{이름}}" ❌ (variable name translated to Korean) + - "{{email}}" → "{{邮箱}}" ❌ (variable name translated to Chinese) + - "" → "<メール>" ❌ (tag name translated) + - "" → "<自定义链接>" ❌ (component name translated) + - Use appropriate language register (formal/informal) based on existing translations - Match existing translation style in each language - Technical terms: check existing conventions per language diff --git a/web/.npmrc b/web/.npmrc new file mode 100644 index 0000000000..cffe8cdef1 --- /dev/null +++ b/web/.npmrc @@ -0,0 +1 @@ +save-exact=true diff --git a/web/app/components/app-sidebar/dataset-info/index.tsx b/web/app/components/app-sidebar/dataset-info/index.tsx index 2d2eeefbb2..ba82099b6c 100644 --- a/web/app/components/app-sidebar/dataset-info/index.tsx +++ b/web/app/components/app-sidebar/dataset-info/index.tsx @@ -71,7 +71,7 @@ const DatasetInfo: FC = ({
{isExternalProvider && t('externalTag', { ns: 'dataset' })} - {!isExternalProvider && isPipelinePublished && dataset.doc_form && dataset.indexing_technique && ( + {!!(!isExternalProvider && isPipelinePublished && dataset.doc_form && dataset.indexing_technique) && (
{t(`chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`, { ns: 'dataset' })} {formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)} diff --git a/web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx b/web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx index 4ba9814255..c81125e973 100644 --- a/web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx +++ b/web/app/components/app-sidebar/dataset-sidebar-dropdown.tsx @@ -114,7 +114,7 @@ const DatasetSidebarDropdown = ({
{isExternalProvider && t('externalTag', { ns: 'dataset' })} - {!isExternalProvider && dataset.doc_form && dataset.indexing_technique && ( + {!!(!isExternalProvider && dataset.doc_form && dataset.indexing_technique) && (
{t(`chunkingMode.${DOC_FORM_TEXT[dataset.doc_form]}`, { ns: 'dataset' })} {formatIndexingTechniqueAndMethod(dataset.indexing_technique, dataset.retrieval_model_dict?.search_method)} diff --git a/web/app/components/app/annotation/edit-annotation-modal/index.tsx b/web/app/components/app/annotation/edit-annotation-modal/index.tsx index b7f7cd1600..2595ec38b2 100644 --- a/web/app/components/app/annotation/edit-annotation-modal/index.tsx +++ b/web/app/components/app/annotation/edit-annotation-modal/index.tsx @@ -144,7 +144,7 @@ const EditAnnotationModal: FC = ({
{t('editModal.removeThisCache', { ns: 'appAnnotation' })}
- {createdAt && ( + {!!createdAt && (
{t('editModal.createdAt', { ns: 'appAnnotation' })}   diff --git a/web/app/components/app/configuration/base/feature-panel/index.tsx b/web/app/components/app/configuration/base/feature-panel/index.tsx index 06ae2ab10a..7f337c1572 100644 --- a/web/app/components/app/configuration/base/feature-panel/index.tsx +++ b/web/app/components/app/configuration/base/feature-panel/index.tsx @@ -28,16 +28,16 @@ const FeaturePanel: FC = ({
- {headerIcon &&
{headerIcon}
} + {!!headerIcon &&
{headerIcon}
}
{title}
- {headerRight &&
{headerRight}
} + {!!headerRight &&
{headerRight}
}
{/* Body */} - {children && ( + {!!children && (
{children}
diff --git a/web/app/components/app/configuration/dataset-config/card-item/index.tsx b/web/app/components/app/configuration/dataset-config/card-item/index.tsx index 81c2b470ad..00d3f6d6ad 100644 --- a/web/app/components/app/configuration/dataset-config/card-item/index.tsx +++ b/web/app/components/app/configuration/dataset-config/card-item/index.tsx @@ -91,7 +91,7 @@ const Item: FC = ({
{ - config.indexing_technique && ( + !!config.indexing_technique && ( = ({
)} { - item.indexing_technique && ( + !!item.indexing_technique && ( = ({ />
- {currentDataset && currentDataset.indexing_technique && ( + {!!(currentDataset && currentDataset.indexing_technique) && (
{t('form.indexMethod', { ns: 'datasetSettings' })}
diff --git a/web/app/components/app/configuration/debug/debug-with-single-model/index.spec.tsx b/web/app/components/app/configuration/debug/debug-with-single-model/index.spec.tsx index b9a1c5ba8b..08bdd2bfcb 100644 --- a/web/app/components/app/configuration/debug/debug-with-single-model/index.spec.tsx +++ b/web/app/components/app/configuration/debug/debug-with-single-model/index.spec.tsx @@ -465,8 +465,8 @@ vi.mock('@/app/components/base/chat/chat', () => ({
))}
- {questionIcon &&
{questionIcon}
} - {answerIcon &&
{answerIcon}
} + {!!questionIcon &&
{questionIcon}
} + {!!answerIcon &&
{answerIcon}
}