--- name: OpenSpec: Translate description: Translate OpenSpec documentation to any target language category: OpenSpec tags: [openspec, translation, i18n] --- <!-- OPENSPEC:START --> **Overview** This command translates OpenSpec-related documentation from English to a specified target language while preserving technical accuracy and document structure.
**Usage** `/openspec:translate <language>`
**Examples** -`/openspec:translate chinese` or `/openspec:translate 中文` -`/openspec:translate japanese` or `/openspec:translate 日本語` -`/openspec:translate spanish` or `/openspec:translate español` -`/openspec:translate korean` or `/openspec:translate 한국어` -`/openspec:translate french` or `/openspec:translate français`
**Target Files** The following files will be translated: -`openspec/project.md` -`openspec/AGENTS.md` -`.claude/commands/openspec/proposal.md` -`.claude/commands/openspec/apply.md` -`.claude/commands/openspec/archive.md` -`AGENTS.md` (OpenSpec section only) -`CLAUDE.md` (OpenSpec section only)
**Excluded Files** The following files will NOT be translated and always remain in English: -`.claude/commands/openspec/translate.md` (this command file itself)
**Language Name Mapping** The system maps English language names to localized names for the language instruction: -`chinese` or `中文` → "中文" -`japanese` or `日本語` → "日本語" -`spanish` or `español` → "español" -`korean` or `한국어` → "한국어" -`french` or `français` → "français"
**Process** 1. Extract target language from command arguments 2. Determine the localized language name for the language instruction 3. Read each target file using the Read tool (skip `.claude/commands/openspec/translate.md`) 4. Translate text content to the specified language while preserving: - Frontmatter (YAML headers) - Code blocks and command examples - Markdown structure (headings, lists, links, tables) - Special markers (e.g., `<!-- OPENSPEC:START -->`) - English commands, file paths, and technical identifiers 5. Write translated content back to original files using the Write tool 6. After translation, append or update language instruction in `CLAUDE.md` and `AGENTS.md`: - Check if file ends with "**Always respond in [language]**" - If exists, replace with new target language - If not exists, append new instruction: "Always respond in [localized language name]" 7. Provide translation progress and completion feedback
**Translation Principles** - Maintain technical terminology accuracy - Use natural, idiomatic expressions in the target language - Preserve all English commands, code, and file paths - Keep the original document's tone and style - Support both English language names (e.g., "chinese") and native names (e.g., "中文")
**WARNING** - Do not translate the command file itself `.claude/commands/openspec/translate.md` <!-- OPENSPEC:END -->
扩展应用
更多自定义命令示例
代码审查:
1 2 3 4 5 6 7 8 9
--- name: Code Review description: Generate a comprehensive code review checklist --- Review the code with focus on: 1. Security vulnerabilities 2. Performance issues 3. Code style consistency 4. Test coverage
文档生成:
1 2 3 4 5 6 7 8
--- name: Generate API Docs description: Auto-generate API documentation from code comments --- Scan all files in `src/api/` and generate: - Endpoint descriptions - Request/response schemas - Example usage