Repository navigation
Closed
Labels
Description
Problem
About 4k lines in harness/ contain Chinese. Most of them are report source text. Four localization mechanisms coexist:
- Post-render translation (Web Fetch, Browser Use). The Chinese HTML is rendered first, then reparsed by
report_i18n.Localizerand rewritten using about 3.3k exact strings, about 210 regexes and 126 substring phrases.- Unmatched text silently falls through as Chinese (
web_fetch/report_i18n.py:507). - Substring phrases produce half-translated sentences.
- About 1.6k of 3.4k Web Fetch keys and 715 of 1.5k Browser Use keys have no verbatim source in Git.
- Unmatched text silently falls through as Chinese (
- Inline ternaries.
"中文" if zh else "English"appears about 145 times inwebarena_report.py, andh(zh, en)lambdas are redefined about 10 times inweb_fetch/report.py. - Hash-derived catalog IDs in Web Search:
text_<sha256(zh)>. Editing the Chinese orphans the ID. - Per-field catalogs in
methods.py. This is the good pattern.
Further problems:
- Chinese display strings are used as machine keys, e.g.
data-kind == '未触发诊断'inreport.pyandwebmainbench_report_check.py. - Sorting is hardcoded to
localeCompare(..., 'zh-CN'). - Model-layer labels (
models.py:7-16) and error messages (reliability.py:47-53) are in Chinese. - Only 8 English Web Fetch routes are CJK-audited.
trajectory_replay/report.pyandpublic_webarena/report.pyare Chinese-only with hard-codedlang="zh-CN", and they do not reject--language enas AGENTS.md requires.
Target design
- One loader,
harness/reporting/i18n.py:t(id, en, **values). English stays inline as source. - Chinese lives in
harness/reporting/locales/zh.jsonplus per-tracklocales/zh.json, with stable semantic IDs. Each entry stores a hash of its English source, so changed English is flagged as stale. - Each language is rendered directly from the same view model. No post-render HTML translation.
- Measured evidence goes through
evidence(value), which markstranslate="no", and is never translated. - Checks:
- AST lint for missing, unused or stale IDs.
- Every English route must have no CJK outside evidence regions.
- Route, table and value parity driven by one route registry.
- Enum keys are English. Chinese is a display label only.
Execution (each step one PR, guarded by golden snapshots)
- Shared catalog loader and lint. Migrate
reporting/locales.py,web_search/messages.py(semantic IDs) and the LexBench loader. - Fail on untranslated English on every route, with the
evidence()wrapper. - Chinese-only replay renderers explicitly reject
--language en. - Trajectory Replay: replace the ternaries with
t(). - Decouple the Browser Use localizer from Web Fetch's
translate_text, and stop readingresearch/*.jsonat import time. - Prune dead translation entries, using hit recording from the golden builds and current profiles.
- Browser Use renders each language directly (about 4 PRs, by route class).
- Web Fetch renders each language directly (about 6 PRs, by route class).
- Delete
Localizerand the post-render link/header rewriting. Update AGENTS.md and the benchmark-report skill. - Non-report Chinese: error messages, model labels, diagnostic prompts. Standardize authored data on
{"en": …, "zh": …}instead of mixed*_zhkeys.
Chinese that legitimately stays
- zh catalogs and Chinese report assets.
- Measured evidence, frozen references and original-language quotations.
- Hash-bound acceptance artifacts (e.g.
case-corrections.jsonIDs). - Chinese test fixtures and negative controls.
docs/README.zh-CN.mdand the humanizer-chinese skill.
Risk: high overall, low per step. Depends on: golden snapshots, the measurements/prose move, and registries.
Part of the refactor roadmap: #87
Activity
lanyue-llk commentedon Nov 4, 2026
Takes over #120 ("Remove Chinese in main src codes"). Scope: text the project writes has English as its source, and Chinese report text lives in catalogs such as
web_search/messages.json. Dataset, web and measured text keeps its raw language.lanyue-llk commentedon Nov 4, 2026
Closing with #245. Where each item in the execution list ended up:
Done
translate_textand no longer readsresearch/*.jsonat import time (refactor(browser-use): make English the source of the report renderer #243).t()with English source (refactor(trajectory-replay): make English the source of the replay report renderers #240).trajectory_replay/core/report.pyandwebarena-report.jskeep some Chinese.t()with English source and a catalog (refactor(web-fetch): make English the source of report text #244).Not planned, with the reason
Localizer, and pruning translation entries: frozen and refresh builds render saved Chinese text through that table. refactor(web-fetch): make English the source of report text #244 deleted entries and real English pages regressed to Chinese, so the table stays. The rewrite is large and the gain is small.--language en, and moving authored data to{"en", "zh"}: minor.Text from outside the project (datasets, web pages, measured output, quotations) keeps its raw language by design.