|
| 1 | +--- |
| 2 | +name: translate-zh-to-en |
| 3 | +description: Translate Chinese documentation to English following the terminology glossary. Use when translating documents from zh/ to en/, or when the user mentions Chinese to English translation. |
| 4 | +--- |
| 5 | + |
| 6 | +# Translate Chinese to English |
| 7 | + |
| 8 | +Translate documents from `zh/` directory to `en/` directory. |
| 9 | + |
| 10 | +## Quick Start |
| 11 | + |
| 12 | +1. Detect target files (see below) |
| 13 | +2. Read glossary: [glossary.md](glossary.md) |
| 14 | +3. Translate document content |
| 15 | +4. Save to corresponding `en/` path |
| 16 | + |
| 17 | +## Target File Detection |
| 18 | + |
| 19 | +**Default behavior**: Check for uncommitted changes in `zh/` directory. |
| 20 | + |
| 21 | +```bash |
| 22 | +git diff --name-only HEAD -- 'zh/*.mdx' |
| 23 | +git diff --name-only --cached -- 'zh/*.mdx' |
| 24 | +``` |
| 25 | + |
| 26 | +If uncommitted `.mdx` files exist in `zh/`: |
| 27 | +- List the detected files |
| 28 | +- Confirm with user before proceeding |
| 29 | + |
| 30 | +If no uncommitted changes: |
| 31 | +- Ask user to specify the document path(s) |
| 32 | +- Example: "Which document would you like to translate? (e.g., zh/platform/xxx.mdx)" |
| 33 | + |
| 34 | +## Translation Rules |
| 35 | + |
| 36 | +### Language Quality |
| 37 | + |
| 38 | +- **Professional & concise**: Avoid Chinglish, use native English expressions |
| 39 | +- **Grammatically correct**: Ensure proper sentence structure |
| 40 | +- **Consistent**: Use the same terminology throughout the document |
| 41 | + |
| 42 | +### Formatting |
| 43 | + |
| 44 | +- **Sentence case**: Capitalize only the first letter of titles/sentences |
| 45 | +- **Punctuation**: Add proper punctuation for complete sentences |
| 46 | +- **Variables**: Keep placeholder order unchanged |
| 47 | + |
| 48 | +### Structure Preservation |
| 49 | + |
| 50 | +| Element | Handling | |
| 51 | +|---------|----------| |
| 52 | +| YAML frontmatter | Translate `title` and `description` | |
| 53 | +| MDX components | Keep tags unchanged, translate inner text | |
| 54 | +| Code blocks | Keep code unchanged, translate comments only | |
| 55 | +| Internal links | Update path prefix to `en/` | |
| 56 | +| Image paths | See **Image Handling** below | |
| 57 | + |
| 58 | +### Image Handling |
| 59 | + |
| 60 | +When translating, check whether the target `en/` file already exists: |
| 61 | + |
| 62 | +- **New translation** (no existing en/ file): Keep image paths from the zh/ source as-is. |
| 63 | +- **Retranslation** (en/ file already exists): Compare image paths between the zh/ source and the existing en/ file. Some docs use **language-specific screenshots** (English UI screenshots in en/, Chinese UI screenshots in zh/) with different CDN hashes. If the existing en/ file has a different image URL at the same position, **keep the en/ version** — it is likely an English screenshot that should not be replaced with the Chinese one. Only adopt the zh/ image path if it is a newly added image with no en/ counterpart. |
| 64 | + |
| 65 | +**How to check**: Before writing the translated file, read the existing en/ file and diff the image URLs. Images with identical URLs across both versions are language-neutral and safe to keep. Images with different URLs (different hash in the CDN path) are language-specific — preserve the en/ version. |
| 66 | + |
| 67 | +## Example |
| 68 | + |
| 69 | +**Input** `zh/on-call/escalate.mdx`: |
| 70 | + |
| 71 | +```mdx |
| 72 | +--- |
| 73 | +title: "配置分派策略" |
| 74 | +description: "了解如何配置分派策略来管理故障升级" |
| 75 | +--- |
| 76 | + |
| 77 | +## 概述 |
| 78 | + |
| 79 | +分派策略定义了告警如何分配给处理人员。 |
| 80 | + |
| 81 | +<Note> |
| 82 | +建议至少配置两个环节的分派策略。 |
| 83 | +</Note> |
| 84 | +``` |
| 85 | + |
| 86 | +**Output** `en/on-call/escalate.mdx`: |
| 87 | + |
| 88 | +```mdx |
| 89 | +--- |
| 90 | +title: "Configure escalation rules" |
| 91 | +description: "Learn how to configure escalation rules to manage incident escalation" |
| 92 | +--- |
| 93 | + |
| 94 | +## Overview |
| 95 | + |
| 96 | +Escalation rules define how alerts are assigned to responders. |
| 97 | + |
| 98 | +<Note> |
| 99 | +It is recommended to configure at least two levels of escalation rules. |
| 100 | +</Note> |
| 101 | +``` |
| 102 | + |
| 103 | +## Key Terminology |
| 104 | + |
| 105 | +Always read the full glossary before translating: [glossary.md](glossary.md) |
| 106 | + |
| 107 | +**Quick reference**: |
| 108 | + |
| 109 | +| Chinese | English | |
| 110 | +|---------|---------| |
| 111 | +| 协作空间 | channel | |
| 112 | +| 故障 | incident | |
| 113 | +| 告警 | alert | |
| 114 | +| 分派策略 | escalation rule | |
| 115 | +| 处理人员 | responders | |
| 116 | +| 认领 | acknowledge | |
| 117 | +| 值班表 | schedule | |
| 118 | + |
| 119 | +## Checklist |
| 120 | + |
| 121 | +- [ ] Check git diff for uncommitted zh/ files |
| 122 | +- [ ] Read terminology glossary |
| 123 | +- [ ] Translate frontmatter (title, description) |
| 124 | +- [ ] Use correct terminology |
| 125 | +- [ ] Preserve MDX component structure |
| 126 | +- [ ] Update internal link paths |
| 127 | +- [ ] Check existing en/ file for language-specific images before overwriting |
| 128 | +- [ ] Apply Sentence case capitalization |
| 129 | +- [ ] Verify output path mirrors source path |
0 commit comments