Multi-Language Translation Workflow
This skill guides the complete process of creating the Developer-Multi-Language branch and translating all Chinese content in source code comments and documentation into English.
Phase 0: Branch Setup
Before any translation work begins:
Check the current branch to confirm the base:
git branch --show-currentCreate and switch to the new branch:
git checkout -b Developer-Multi-LanguageVerify the branch was created successfully:
git branch --show-current
Phase 1: Translate Source Code Comments
Scope
- Include: All source code files:
.cs,.js,.ts,.css,.scss,.less,.html(attribute values and template text are excluded; only comments and string literals used as developer-facing notes). - Exclude: Configuration files (
.csproj,.json,.xml,.yaml,.yml,.config,.props,.targets), binary files, and generated files (e.g.,obj/,bin/,Generated/directories,*.designer.cs,*.g.cs). - Exclude: UI display text (e.g., Razor
.cshtmlpage visible text,<label>,<button>human-readable content), only translate code comments and XML doc comments.
What counts as a "comment"
- Single-line comments:
// 中文注释 - Multi-line comments:
/* 中文 */ - XML doc comments:
/// <summary>中文</summary> - CSS/SCSS/JS comments:
/* 中文 */,// 中文
Translation Rules
- Translate comment content from Chinese to natural, idiomatic English.
- Preserve all code logic, formatting, indentation, and comment markers exactly.
- Do not alter any code, variable names, string values used at runtime, or file structure.
- Do not modify
.csprojor any other config/project metadata files. - If a comment is already in English (or another language), leave it unchanged.
Workflow per file batch
- Identify files containing Chinese characters using:
grep -rl '[^\x00-\x7F]' src/ --include="*.cs" --include="*.js" --include="*.ts" --include="*.css" --include="*.scss" - Work through files in logical groups (e.g., by module/folder).
- For each file:
- Read the file to understand context.
- Translate all Chinese comments to English in-place.
- Verify no code logic was changed.
- After completing each module/folder group:
- Compile check (for C# changes):
dotnet buildfrom the relevant project or solution root. - Commit with a descriptive message:
git commit -m "translate: Chinese comments to English in [ModuleName]"
- Compile check (for C# changes):
Phase 2: Translate README and Documentation Files
Scope
- Include: All
.mdfiles in the repository root,docs/, and anyREADME*.mdfiles in subdirectories. - Exclude: Auto-generated changelogs, tool-generated files, and files already in English.
Workflow per markdown file
For each .md file that contains Chinese content:
Create a Chinese copy (backup) by copying the original file with a
.cn.mdsuffix:- Example:
README.md→README.cn.md - Example:
docs/KnowledgeBase-Embedding-Implementation.md→docs/KnowledgeBase-Embedding-Implementation.cn.md - The
.cn.mdfile is the preserved Chinese version — do not modify it.
- Example:
Translate the source file (the original, e.g.,
README.md) into English:- Translate all headings, paragraphs, list items, table content, and code block descriptions.
- Preserve all Markdown formatting: headings (
#), bold (**), code blocks (`and```), links, tables, etc. - Do not translate code samples inside fenced code blocks — only translate surrounding prose and inline comments within code blocks if they are in Chinese.
- If the file is already entirely in English, skip it (do not create a
.cn.md).
After completing each documentation group:
- Commit with a descriptive message:
git commit -m "translate: README/docs [filename] to English, preserve .cn.md"
- Commit with a descriptive message:
Phase 3: Final Verification and Cleanup
Full build check to ensure no compilation errors were introduced:
dotnet build src/NcfPackageSources.slnFix any compilation errors before proceeding.
Verify no Chinese characters remain in source code comments:
grep -rn '[^\x00-\x7F]' src/ --include="*.cs" --include="*.js" --include="*.ts" --include="*.css"Review any remaining occurrences to confirm they are in-code string literals (acceptable) and not comments.
Final commit summarizing the overall change:
git commit -m "feat: complete Chinese-to-English translation for Developer-Multi-Language branch"
Commit Message Conventions
Use the following prefixes for all commits in this workflow:
| Prefix | Usage |
|---|---|
translate: |
Source code comment translations |
translate: README/docs |
Documentation file translations |
feat: |
Final summary or phase-completion commits |
fix: |
Compilation fixes discovered during the process |
Important Constraints
- Never modify
.csproj,.json,.xml,.yaml,.ymlconfiguration files for translation purposes. - Never change runtime string values, enum names, method names, variable names, or any logic.
- Never remove the
.cn.mdChinese backup files — they are permanent parallel files. - Always commit after completing each module or document group rather than batching everything into one large commit.
- Always run a compilation check after translating any
.csfiles to catch accidental syntax corruption early. - When a file is too large to translate in a single pass, split by logical sections (class, region, or function grouping) and commit after each section is complete.
Source: NeuCharFramework/NcfPackageSources — distributed by TomeVault.