# Translate Explanation

Translate existing code-explanation docs into another language, Chinese by default.

- Repository: https://github.com/Leanmcp/gateway-skills (2122 stars)
- Category: Writing
- License: MIT
- Last updated: 2026-10-07
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add Leanmcp/gateway-skills --skill translate-explanation -g -a claude-code -y`
Codex: `npx skills add Leanmcp/gateway-skills --skill translate-explanation -g -a codex -y`
Cursor: `npx skills add Leanmcp/gateway-skills --skill translate-explanation -g -a cursor -y`
Gemini CLI: `npx skills add Leanmcp/gateway-skills --skill translate-explanation -g -a gemini-cli -y`

## Description

Translate existing code-explanation docs into another language, Chinese by default. Translates a whole `CODE_EXPLANATION/` folder into a parallel `CODE_EXPLANATION_<LANG>` copy (e.g. `CODE_EXPLANATION_ZH`), or a single file, either bilingually in place (English + translation interleaved) for small files or as a `<name>_<lang>.<ext>` sidecar copy for larger ones. Keeps filenames, code, identifiers, file paths, and technical terms in English, only the explanatory prose is translated. Use this skill whenever the user wants to translate, localize, or produce a non-English version of code-explanation / codebase documentation: phrases like "translate-explanation", "translate the code explanation", "translate the CODE_EXPLANATION folder", "localize these docs to Chinese", "make a Chinese version of the explanation", or naming any target language for the explanation files. Default to Chinese (ZH) when no language is specified.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Translate Explanation

Translate generated code-explanation docs (the kind produced by the
`code-explanation` skill) into another language. The prose is translated but
everything technical stays in English so the docs remain accurate and usable by
engineers.

**Default language is Chinese (`ZH`).** If the user names another language, use
its code instead (see the table below).

## Translation modes

First decide what's being translated, a whole folder or a single file, because
the output shape differs.

**Folder mode (default).** The target is a `CODE_EXPLANATION/` folder (or any
folder of docs). Produce a parallel folder named `<FOLDER>_<LANG>` (e.g.
`CODE_EXPLANATION_ZH`) with the same files. See *Folder mode* below.

**Single-file mode.** The target is one file. Choose between two output styles
based on the file's length, because what's pleasant to read differs by size:

- **Bilingual / interleaved (small files, < 50 lines).** Update the file
  in place so each prose line is immediately followed by its translation, English line, then Chinese line. For short files this keeps original and
  translation together and is easy to scan. See *Single-file mode → Bilingual*.
- **Sidecar file (larger files, ≥ 50 lines).** Don't clutter a long file with
  interleaving. Instead create a fully-translated copy named
  `<name>_<lang>.<ext>` (e.g. `notes_zh.md`) in the **same folder**, leaving the
  original untouched. See *Single-file mode → Sidecar*.

Use the line count of the source file to pick the style; if the user explicitly
asks for one style, honor that regardless of size.

In every mode, the rules in *What to translate vs. keep as-is* apply.

## Folder mode

### 1. Locate the source folder

The rest: https://github.com/Leanmcp/gateway-skills/blob/HEAD/skills/translate-explanation/SKILL.md
