reply-language
Keeps user-facing replies in your language, taken from REPLY_LANGUAGE, Claude Code's language setting or the system language (first release: Chinese, zh).
- Reply quality
- When a reply ends
- Claude Code
- Codex
What it blocks
With target language Chinese:
| Reply | Result |
|---|---|
| A final reply mostly in English | Stop blocked once |
| A final reply in Japanese | Stop blocked once |
| A progress note mostly in English | Reminder, never blocked |
| Chinese with English terms, code, paths and URLs | Allowed |
A short reply (OK, done. Tests pass.) | Allowed: too short to judge |
What the agent sees when blocked
For a final reply:
This reply is mostly not in Chinese. Rewrite it in Chinese (code, commands, paths and technical terms may stay as they are) before ending the turn, and write the rest of this turn's progress notes in Chinese too.
For a progress note:
The last progress note shown to the user was mostly not in Chinese. Write user-facing text in Chinese (code, commands, paths and technical terms may stay as they are), starting with the next sentence.
Why this plugin
Scenario
In long sessions with many tool calls, replies drift into English without anyone noticing, even when your instructions ask for Chinese. The author measured English at 25–32% of progress notes at one point.
Why use it
- An off-language final reply is caught at the end of the turn, and the agent rewrites it.
- An off-language progress note gets a reminder, so the drift stops early.
- Code, commands, paths and URLs are not counted, so a Chinese reply full of terms still passes.
How it works
- Stop hook: when the final reply is mostly not in the target language, it blocks the stop once. The agent's retry is let through, so a turn is blocked at most once. A retry caused by another Stop hook's block is still judged.
- PostToolUse hook: when the latest progress note the user already saw is mostly not in the target language, it adds a reminder to the agent's context. It never blocks and judges each note once. The reminder arrives one tool call late, because a reply is written to the transcript after its tool calls finish. It reads Claude Code's transcript format; in Codex it does nothing.
Only prose is measured. Code blocks, inline code, URLs and paths are removed first. A reply fails when, in what is left:
- Latin letters ≥ 60 (30 for progress notes) and Latin letters > 3 × Han characters; or
- for
zh: kana (hiragana and katakana) ≥ 20 (10 for progress notes) and kana ≥ 0.5 × Han characters. Japanese prose writes more kana than kanji, while a Chinese reply that quotes a Japanese word or sentence has a few kana against many Han characters, so it passes.
The target language is the first of these sources that has a value. Later sources are not read, so an unsupported value stops there:
REPLY_LANGUAGE(offornoneturns the plugin off).- Claude Code's
languagesetting, from<cwd>/.claude/settings.local.json,<cwd>/.claude/settings.json, then${CLAUDE_CONFIG_DIR:-~/.claude}/settings.json.cwdcomes from the hook input. The setting is free text, so简体中文,中文,Chineseandzh-CNall meanzh. An unreadable file is skipped. - The system language: on macOS the first entry of
defaults read -g AppleLanguages; otherwise, or when that fails, the first set ofLC_ALL,LC_MESSAGES,LANG.
Every error, missing field or short message lets the stop through (exit 0, no output). No network, no model call.