返回技能列表

translate-content

pjt222
更新于 2 days ago
5 次查看
17
2
17
在 GitHub 上查看
aidesign

关于

This skill translates technical documentation (skills, agents, guides) into different languages while preserving critical elements like code blocks and IDs. It handles the full localization workflow, including setup, prose translation, and tracking updates. Use it for initial translations, updating stale content, or batch-translating entire domains.

快速安装

Claude Code

推荐
主要方式
npx skills add pjt222/agent-almanac -a claude-code
插件命令备选方式
/plugin add https://github.com/pjt222/agent-almanac
Git 克隆备选方式
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/translate-content

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

Translate Content

Translate English source content into a target locale, preserving technical accuracy and structural integrity.

When to Use

  • Localizing a skill, agent, team, or guide into a supported language
  • Updating a translation that has become stale after source changes
  • Batch-translating multiple items within a domain or content type
  • Creating initial translations for a new locale

Inputs

  • Required: Content type — skills, agents, teams, or guides
  • Required: Item ID — the name/identifier of the content (e.g., create-r-package)
  • Required: Target locale — IETF BCP 47 code (e.g., de, zh-CN, ja, es)
  • Optional: Batch list — multiple IDs to translate in sequence

Procedure

Step 1: Read the English source

1.1. Determine the source file path:

  • Skills: skills/<id>/SKILL.md
  • Agents: agents/<id>.md
  • Teams: teams/<id>.md
  • Guides: guides/<id>.md

1.2. Read the entire source file to understand context, structure, and content.

1.3. Identify sections that must stay in English:

  • All code blocks (fenced with triple backticks)
  • Inline code (backtick-wrapped)
  • YAML frontmatter field names and technical values (name, tools, model, priority, skills list entries, allowed-tools, tags, domain, language)
  • File paths, URLs, command examples
  • <!-- CONFIG:START --> / <!-- CONFIG:END --> blocks in teams

Got: Full understanding of source content with clear mental separation of translatable prose vs preserved technical content.

If fail: If source file is not found, verify the ID exists in the registry. Check for typos in the content type or ID.

Step 2: Scaffold the translation file

2.1. Run the scaffolding script:

npm run translate:scaffold -- <content-type> <id> <locale>

2.2. If the file already exists, read it to check whether it needs updating (stale) or is already current.

2.3. Verify the scaffolded file has translation frontmatter fields:

  • locale — matches target locale
  • source_localeen
  • source_commit — current git short hash
  • translator — attribution string
  • translation_date — today's date

Got: Scaffolded file at i18n/<locale>/<content-type>/<id>/SKILL.md (or .md for other types) with correct frontmatter.

If fail: If the scaffold script fails, create the directory manually with mkdir -p and copy the source file. Add frontmatter fields manually.

Step 3: Translate the description

3.1. Translate the description field in the YAML frontmatter into the target locale.

3.2. For skills, the description is inside the top-level frontmatter. For agents/teams/guides, it is also in the top-level frontmatter.

3.3. Keep the translation concise — match the length and style of the original.

Got: Description field contains an idiomatic translation that accurately conveys the original meaning.

If fail: If the description is ambiguous, keep it closer to literal translation rather than risk misinterpretation.

Step 4: Translate prose sections

4.1. Translate all prose content section by section:

  • Section headings (e.g., "## When to Use" → "## Wann verwenden" in German)
  • Paragraph text
  • List item text (but not list item code/paths)
  • Table cell text (but not table cell code/values)

4.2. Preserve these elements exactly as-is:

  • Code blocks (``` fenced and indented)
  • Inline code (backtick-wrapped)
  • File paths and URLs
  • Skill/agent/team IDs in cross-references
  • YAML/JSON configuration examples
  • Command-line examples
  • **Got:** and **If fail:** markers (translate the label, keep the structure)

4.3. For skills, translate the standardized section names:

  • "When to Use" → locale equivalent
  • "Inputs" → locale equivalent
  • "Procedure" → locale equivalent
  • "Validation" → locale equivalent
  • "Common Pitfalls" → locale equivalent
  • "Related Skills" → locale equivalent

4.4. For agents, translate:

  • Purpose, Capabilities, Available Skills (section name only — skill IDs stay English), Usage Scenarios, Best Practices, Examples, Limitations, See Also

4.5. For teams, translate:

  • Purpose, Team Composition (prose only — IDs stay English), Coordination Pattern, Task Decomposition, Usage Scenarios, Limitations

4.6. For guides, translate:

  • All prose sections, troubleshooting text, table descriptions
  • Keep command examples, code blocks, and configuration snippets in English

Got: All prose sections translated idiomatically. Code blocks identical to English source. Cross-references use English IDs.

If fail: If uncertain about a technical term, keep the English term with a parenthetical translation. Example: "Staging-Bereich (Staging Area)" in German.

Step 5: Verify structural integrity

5.1. Confirm the translated file has the same number of sections as the source.

5.2. For skills, verify all required sections are present:

  • YAML frontmatter with name, description, allowed-tools, metadata
  • When to Use, Inputs, Procedure, Validation, Common Pitfalls, Related Skills

5.3. Verify code blocks are identical to the English source (diff the fenced blocks).

5.4. Check line count: skills must be ≤ 500 lines.

5.5. Verify name field matches the English source exactly (it is the ID, never translated).

Got: Structurally valid translated file that passes validation.

If fail: Compare section-by-section with the English source. Restore any missing sections.

Step 5.5: Verify prose is translated

5.5.1. Sample 3 prose paragraphs from the body of the translated file. Choose paragraphs from different sections — not headings, not code blocks, not frontmatter.

5.5.2. Confirm each sampled paragraph is written in the target language, not English.

5.5.3. If any sampled paragraph is still in English, the translation is incomplete. Return to Step 4 and translate the remaining English prose before proceeding.

Got: All 3 sampled prose paragraphs are in the target language, confirming the body text has been translated — not just headings and frontmatter.

If fail: Identify which sections still contain English prose. Translate them before continuing to Step 6.

Step 6: Write the translated file

6.1. Write the complete translated content to the target path using the Write or Edit tool.

6.2. Verify the file exists at the expected path:

  • Skills: i18n/<locale>/skills/<id>/SKILL.md
  • Agents: i18n/<locale>/agents/<id>.md
  • Teams: i18n/<locale>/teams/<id>.md
  • Guides: i18n/<locale>/guides/<id>.md

Got: Translated file written to disk at the correct path.

If fail: Check directory exists. Create with mkdir -p if needed.

Validation

  • Translated file exists at i18n/<locale>/<type>/<id>
  • name field matches English source exactly
  • locale field matches target locale
  • source_commit field is set to a valid git short hash
  • All code blocks are identical to English source
  • All cross-referenced IDs (skills, agents, teams) are in English
  • File is under 500 lines (for skills)
  • npm run validate:translations reports no issues for this file
  • Prose reads idiomatically in the target language

Pitfalls

  • Translating code blocks: Code, commands, and configuration must stay in English. Only translate surrounding prose.
  • Translating the name field: The name field is the canonical ID. Never translate it.
  • Translating tag values: Tags in metadata.tags stay in English for cross-locale consistency.
  • Inconsistent terminology: Use the same translation for a technical term throughout the file and across files in the same locale.
  • Literal translation of idioms: Translate the meaning, not the words. "Common Pitfalls" should become the locale's natural equivalent, not a word-for-word translation.
  • Missing source_commit: Without this field, freshness tracking breaks. Always include it.
  • Batch throughput over quality: Scaffolding-only output — where headings are translated but body text remains in English — is not a valid translation. Prefer fewer complete translations over many partial ones.
  • Exceeding 500 lines: Translations may expand ~10-20% vs English. If near the limit, tighten prose rather than removing content.

Related Skills

GitHub 仓库

pjt222/agent-almanac
路径: i18n/caveman-lite/skills/translate-content
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

相关推荐技能

content-collections

Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。

查看技能

polymarket

这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。

查看技能

creating-opencode-plugins

该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。

查看技能

sglang

SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。

查看技能