Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/scripts/validate-links.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# Configuration rules
RULES = {
'ZH_CN_DIR': 'zh-CN',
'ZH_CN_DIR': 'zh',
'ZH_SNIPPETS_DIR': 'snippets/zh',
'ZH_IMAGES_DIR': 'images/zh',
'COMMON_IMAGES_DIR': 'images'
Expand Down Expand Up @@ -156,7 +156,7 @@ def should_add_slash(link: str) -> bool:

# Check if it looks like a documentation path (contains common doc patterns)
doc_patterns = [
'zh-CN/', 'tutorials/', 'built-in-nodes/', 'interface/', 'installation/',
'zh/', 'tutorials/', 'built-in-nodes/', 'interface/', 'installation/',
'development/', 'custom-nodes/', 'troubleshooting/', 'registry/', 'specs/',
'get_started/', 'changelog/', 'comfy-cli/', 'snippets/', 'community/'
]
Expand Down
42 changes: 21 additions & 21 deletions .github/workflows/zh-cn-sync-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
paths:
- '**/*.mdx'
- '!zh-CN/**/*.mdx'
- '!zh/**/*.mdx'
- '!snippets/zh/**/*.mdx'
- '!ja/**/*.mdx'
- '!snippets/ja/**/*.mdx'
Expand All @@ -29,21 +29,21 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Check changed MDX files have zh-CN equivalents and check for moved files
- name: Check changed MDX files have zh equivalents and check for moved files
id: check-translations
run: |
# Get list of changed MDX files
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep "\.mdx$" | grep -v "^zh-CN/" | grep -v "^snippets/zh/" | grep -v "^ja/" | grep -v "^snippets/ja/" || true)
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep "\.mdx$" | grep -v "^zh/" | grep -v "^snippets/zh/" | grep -v "^ja/" | grep -v "^snippets/ja/" || true)

# Get list of deleted MDX files (potentially moved)
DELETED_FILES=$(git diff --name-only --diff-filter=D ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep "\.mdx$" | grep -v "^zh-CN/" | grep -v "^snippets/zh/" | grep -v "^ja/" | grep -v "^snippets/ja/" || true)
DELETED_FILES=$(git diff --name-only --diff-filter=D ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep "\.mdx$" | grep -v "^zh/" | grep -v "^snippets/zh/" | grep -v "^ja/" | grep -v "^snippets/ja/" || true)

# Get list of added MDX files (potentially destinations of moves)
ADDED_FILES=$(git diff --name-only --diff-filter=A ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep "\.mdx$" | grep -v "^zh-CN/" | grep -v "^snippets/zh/" | grep -v "^ja/" | grep -v "^snippets/ja/" || true)
ADDED_FILES=$(git diff --name-only --diff-filter=A ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep "\.mdx$" | grep -v "^zh/" | grep -v "^snippets/zh/" | grep -v "^ja/" | grep -v "^snippets/ja/" || true)

# Exit if no MDX files were changed, deleted or added
if [ -z "$CHANGED_FILES" ] && [ -z "$DELETED_FILES" ] && [ -z "$ADDED_FILES" ]; then
echo "No MDX files changed outside of zh-CN and snippets/zh directories. Skipping check."
echo "No MDX files changed outside of zh and snippets/zh directories. Skipping check."
exit 0
fi

Expand Down Expand Up @@ -125,27 +125,27 @@ jobs:
fi
fi

echo "Changed MDX files outside zh-CN directory:"
echo "Changed MDX files outside zh directory:"
echo "$CHANGED_FILES"
echo "------------------------"

# Check each file for corresponding zh-CN updates
# Check each file for corresponding zh updates
MISSING_TRANSLATIONS=""
for file in $CHANGED_FILES; do
# Determine the corresponding zh-CN path based on whether it's a snippet or not
# Determine the corresponding zh path based on whether it's a snippet or not
if [[ $file == snippets/* ]]; then
# For snippets, the Chinese version should be in snippets/zh/
zh_file="${file/snippets\//snippets\/zh\/}"
else
# For regular docs, the Chinese version should be in zh-CN/
zh_file="zh-CN/${file}"
# For regular docs, the Chinese version should be in zh/
zh_file="zh/${file}"
fi

# Check if the corresponding zh-CN file was also modified
# Check if the corresponding zh file was also modified
if git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -q "^${zh_file}$"; then
echo "✅ Found corresponding change: ${zh_file}"
else
# Check if the zh-CN file exists at all
# Check if the zh file exists at all
if [ -f "${zh_file}" ]; then
echo "❌ Missing update to existing file: ${zh_file}"
MISSING_TRANSLATIONS="$MISSING_TRANSLATIONS ${zh_file}"
Expand All @@ -156,18 +156,18 @@ jobs:
fi
done

# For added files, check corresponding zh-CN files
# For added files, check corresponding zh files
for file in $ADDED_FILES; do
# Determine the corresponding zh-CN path based on whether it's a snippet or not
# Determine the corresponding zh path based on whether it's a snippet or not
if [[ $file == snippets/* ]]; then
# For snippets, the Chinese version should be in snippets/zh/
zh_file="${file/snippets\//snippets\/zh\/}"
else
# For regular docs, the Chinese version should be in zh-CN/
zh_file="zh-CN/${file}"
# For regular docs, the Chinese version should be in zh/
zh_file="zh/${file}"
fi

# Check if the corresponding zh-CN file was also added or renamed
# Check if the corresponding zh file was also added or renamed
if git diff --name-only --diff-filter=AR ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -q "^${zh_file}$"; then
echo "✅ Found corresponding added/renamed file: ${zh_file}"
# Also check with rename detection to catch renamed files
Expand All @@ -189,7 +189,7 @@ jobs:
for missing in $MISSING_TRANSLATIONS; do
echo "- $missing"
done
echo "::warning::The following zh-CN translation files need to be updated to stay in sync with the English version:$MISSING_TRANSLATIONS"
echo "::warning::The following zh translation files need to be updated to stay in sync with the English version:$MISSING_TRANSLATIONS"
fi

# Check for moved files without redirects
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ A GitHub Action will check for redirects and fail the PR if they are missing. Re
> }
> ]
> ```
> Don't forget to include the corresponding Chinese translation file in the `zh-CN` directory as well!
> Don't forget to include the corresponding Chinese translation file in the `zh` directory as well!

You can also refer to the [Mintlify doc](https://www.mintlify.com/docs/create/redirects) to learn how to add and match a wildcard path.

Expand Down Expand Up @@ -78,11 +78,11 @@ Mintlify uses versioning to add other languages. To add a translation of a page,

1. Create a file under the language code with the same exact filename of the original English filename.

For example: If you are translating `introduction.mdx` into Chinese, create a file under `zh-CN/get_started/introduction.mdx`.
For example: If you are translating `introduction.mdx` into Chinese, create a file under `zh/get_started/introduction.mdx`.

Specifications for file editing can be found in the Writing Content section of the [Mintlify](https://mintlify.com/docs/page) document

> **Important**: When you modify an existing MDX file in the English documentation, you must also update the corresponding file in the `zh-CN` directory. A GitHub Action will automatically check for this and fail the PR if the corresponding Chinese translations are not updated.
> **Important**: When you modify an existing MDX file in the English documentation, you must also update the corresponding file in the `zh` directory. A GitHub Action will automatically check for this and fail the PR if the corresponding Chinese translations are not updated.

2. Update navigation for `docs.json`

Expand Down Expand Up @@ -114,7 +114,7 @@ For `introduction.mdx`:
{
"group": "开始行动",
"pages": [
"zh-CN/get_started/introduction",
"zh/get_started/introduction",
...
]
}
Expand Down
8 changes: 4 additions & 4 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ npx @mintlify/scraping@latest openapi-file <path-to-openapi-file>
> }
> ]
> ```
> 同时不要忘记在 `zh-CN` 目录中包含相应的中文翻译文件!
> 同时不要忘记在 `zh` 目录中包含相应的中文翻译文件!

## 关于 ComfyUI 节点文档的更新说明

Expand Down Expand Up @@ -80,11 +80,11 @@ Mintlify 使用版本控制来添加其他语言。要添加页面的翻译,

1. 在语言代码下创建与原始英文文件名完全相同的文件。

例如:如果你要将 `introduction.mdx` 翻译成中文,请在 `zh-CN/get_started/introduction.mdx` 下创建文件。
例如:如果你要将 `introduction.mdx` 翻译成中文,请在 `zh/get_started/introduction.mdx` 下创建文件。

文件编辑的规范可以参考 [Mintlify](https://mintlify.com/docs/page) 文档中Writing Content(内容撰写)部分的章节

> **重要提示**:当你修改英文文档中的现有 MDX 文件时,必须同时更新 `zh-CN` 目录中的对应文件。GitHub Action 将自动检查此事项,如果相应的中文翻译未更新,PR 将无法通过检查。
> **重要提示**:当你修改英文文档中的现有 MDX 文件时,必须同时更新 `zh` 目录中的对应文件。GitHub Action 将自动检查此事项,如果相应的中文翻译未更新,PR 将无法通过检查。

3. 更新 `doocs.json` 的导航

Expand Down Expand Up @@ -116,7 +116,7 @@ Mintlify 使用版本控制来添加其他语言。要添加页面的翻译,
{
"group": "开始行动",
"pages": [
"zh-CN/get_started/introduction",
"zh/get_started/introduction",
...
]
}
Expand Down
Loading
Loading