Skip to content

Make English the source language of all report renderers, with Chinese as a catalog #99

Closed

Description

@lanyue-llk

Problem

About 4k lines in harness/ contain Chinese. Most of them are report source text. Four localization mechanisms coexist:

  1. Post-render translation (Web Fetch, Browser Use). The Chinese HTML is rendered first, then reparsed by report_i18n.Localizer and 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.
  2. Inline ternaries. "中文" if zh else "English" appears about 145 times in webarena_report.py, and h(zh, en) lambdas are redefined about 10 times in web_fetch/report.py.
  3. Hash-derived catalog IDs in Web Search: text_<sha256(zh)>. Editing the Chinese orphans the ID.
  4. 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 == '未触发诊断' in report.py and webmainbench_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.py and public_webarena/report.py are Chinese-only with hard-coded lang="zh-CN", and they do not reject --language en as 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.json plus per-track locales/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 marks translate="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 reading research/*.json at 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 Localizer and 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 *_zh keys.

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.json IDs).
  • Chinese test fixtures and negative controls.
  • docs/README.zh-CN.md and 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

  1. added
    enhancement
    refactor
    on Oct 29, 2026
  2. lanyue-llk commented on Nov 4, 2026

    @lanyue-llk
    ContributorAuthor

    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.

  3. lanyue-llk commented on Nov 4, 2026

    @lanyue-llk
    ContributorAuthor

    Closing with #245. Where each item in the execution list ended up:

    Done

    Not planned, with the reason

    • Web Fetch direct per-language rendering, deleting 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.
    • A shared catalog loader, a lint, and failing on untranslated English on every route: more machinery than the remaining text justifies.
    • Replay renderers rejecting --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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementrefactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions