Skip to content
All plugins

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).

What it blocks

With target language Chinese:

ReplyResult
A final reply mostly in EnglishStop blocked once
A final reply in JapaneseStop blocked once
A progress note mostly in EnglishReminder, never blocked
Chinese with English terms, code, paths and URLsAllowed
A short reply (OK, done. Tests pass.)Allowed: too short to judge

What the agent sees when blocked

For a final reply:

text
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:

text
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:

  1. Latin letters ≥ 60 (30 for progress notes) and Latin letters > 3 × Han characters; or
  2. 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:

  1. REPLY_LANGUAGE (off or none turns the plugin off).
  2. Claude Code's language setting, from <cwd>/.claude/settings.local.json, <cwd>/.claude/settings.json, then ${CLAUDE_CONFIG_DIR:-~/.claude}/settings.json. cwd comes from the hook input. The setting is free text, so 简体中文, 中文, Chinese and zh-CN all mean zh. An unreadable file is skipped.
  3. The system language: on macOS the first entry of defaults read -g AppleLanguages; otherwise, or when that fails, the first set of LC_ALL, LC_MESSAGES, LANG.

Every error, missing field or short message lets the stop through (exit 0, no output). No network, no model call.