Skip to content

i18n(hooks/summary): localize hook outcome and force-summary text#446

Merged
esengine merged 1 commit into
mainfrom
i18n/hook-events-and-loop-helpers
May 8, 2026
Merged

i18n(hooks/summary): localize hook outcome and force-summary text#446
esengine merged 1 commit into
mainfrom
i18n/hook-events-and-loop-helpers

Conversation

@esengine

@esengine esengine commented May 8, 2026

Copy link
Copy Markdown
Owner

Why

Two small follow-on batches after #445.

Hook outcomes were hardcoded — `hook ${tag} \\${cmd}\\ ${decision}${truncTag}`. A Chinese user with a failing PreToolUse hook saw "hook PreToolUse/Bash `npm test` block (output truncated at 256KB)" with all the structural words still in English.

Force-summary path had three user-visible strings: the "summarizing…" status, the hallucinated-markup fallback, and the post-failure error template.

What

`hooks.*` namespace

  • `head` / `headWithDetail` — the two output shapes (with / without trailing detail)
  • `truncated` — " (output truncated at 256KB)"
  • `decision{Block,Warn,Timeout,Error}` — translated verbs

`tag` and `cmd` are identifiers, kept verbatim. The decision verb is looked up by `outcome.decision` (the typed enum) so the formatter input doesn't change.

`summary.*` namespace

  • `status` — "summarizing what was gathered…"
  • `hallucinatedFallback` — the message when R1 emits fake tool-call markup
  • `failedAfterReason` — the error template when even the fallback summary call fails

zh-CN translations included for all 10 keys.

Test plan

  • Full suite 2301 pass (no test changes — the format strings flow through existing assertions)
  • tsc + biome clean

Follow-ups

Still on the queue:

  • `src/cli/ui/App.tsx` slash command outputs (~30 strings — biggest remaining chunk)

Two small follow-on batches after #445:

1. hooks.formatHookOutcomeMessage — was hardcoded
   \`hook \${tag} \\`\${cmd}\\` \${decision}\${truncTag}\`. Pulls
   the structural words (\"hook\", decision verb, \" (output truncated
   at 256KB)\") into a new \`hooks.*\` namespace. The technical bits
   (tag, cmd) stay verbatim — they're identifiers, not prose.

2. loop/force-summary.ts — three user-visible strings:
   - \"summarizing what was gathered…\" (status during summary call)
   - the fallback when the model emits hallucinated tool-call markup
     instead of prose
   - the error template when the fallback summary itself crashes

New \`summary.*\` namespace covers all three. zh-CN translations included.

Decision verbs (block / warn / timeout / error) are translated via a
small \`hooks.decision\${Capitalize}\` lookup so the formatter still
takes \`outcome.decision\` (the typed enum) as input.

Test plan: full suite 2301 pass; tsc + biome clean.
@esengine esengine merged commit 40628d0 into main May 8, 2026
3 checks passed
@esengine esengine deleted the i18n/hook-events-and-loop-helpers branch May 8, 2026 11:50
ChasLui pushed a commit to ChasLui/DeepSeek-Reasonix that referenced this pull request May 23, 2026
…engine#446)

Two small follow-on batches after esengine#445:

1. hooks.formatHookOutcomeMessage — was hardcoded
   \`hook \${tag} \\`\${cmd}\\` \${decision}\${truncTag}\`. Pulls
   the structural words (\"hook\", decision verb, \" (output truncated
   at 256KB)\") into a new \`hooks.*\` namespace. The technical bits
   (tag, cmd) stay verbatim — they're identifiers, not prose.

2. loop/force-summary.ts — three user-visible strings:
   - \"summarizing what was gathered…\" (status during summary call)
   - the fallback when the model emits hallucinated tool-call markup
     instead of prose
   - the error template when the fallback summary itself crashes

New \`summary.*\` namespace covers all three. zh-CN translations included.

Decision verbs (block / warn / timeout / error) are translated via a
small \`hooks.decision\${Capitalize}\` lookup so the formatter still
takes \`outcome.decision\` (the typed enum) as input.

Test plan: full suite 2301 pass; tsc + biome clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant