Skip to content

i18n: full English localization of UI, backend, roles and docs - #373

Open
jaweesh wants to merge 21 commits into
AIPentest:mainfrom
jaweesh:i18n-english
Open

jaweesh wants to merge 21 commits into
AIPentest:mainfrom
jaweesh:i18n-english

Conversation

@jaweesh

@jaweesh jaweesh commented Oct 28, 2026 •

Copy link
Copy Markdown

Summary

Full English localization of the platform while keeping Chinese protocol/wire markers byte-identical for compatibility with historical rows and frontend regexes.

Backend

  • fmt.Errorf, zap logs and handler responses localized by request language via respondError/respondErrorf/i18nText dual-accept
  • Protocol markers (toolGuardBlockedPrefix, prepare.go validation errors matched by multiAgentHTTPErrorStatus) kept Chinese byte-identical
  • Seed skills, roles, agents and tools translated

Roles / agents / skills / tools

  • Chinese-named role YAMLs renamed to English, prompts/descriptions/tags translated (Chinese docs preserved as README_CN.md)

Frontend (web/static/js)

  • en-US/ru-RU i18n keys filled with contract across all frontend JS
  • All remaining Chinese in web/static/js translated across 40 files (~5,400 lines): inline comments, doc blocks, trailing comments, t() fallback literals, multiline prompt templates (${placeholder} preserved), knowledge.js data-i18n text nodes
  • Functional regexes made dual-accept: legacy Chinese alternative kept for historical rows, English alternative added (assets sheet/backend messages, chat execute/call-OpenAI failed prefixes, webshell dir/ls parsing, monitor timeout/guard-block/soft-wait, knowledge not-enabled, hitl destructive-score, workflows keyword matching)
  • All .js pass node --check; remaining CJK is only in deliberate legacy/dual-accept regexes and git-tracked test fixtures

Docs / plugins

  • README, CHANGELOG, docs/zh-CN, Burp extension labels, browser-extension panel

Database

  • All rows previously holding Chinese content translated; 0 CJK characters remain across all tables

Backends dual-accept both Chinese (historical rows) and English (new rows) text; frontend .test.cjs suites and backend package tests pass (only pre-existing environment failures remain).

👤 Generated with Claude Code

jaweesh and others added 21 commits October 28, 2026 10:05
…anguage

Convert all c.JSON error/message sites in internal/handler to
respondError/respondErrorf/i18nText per Accept-Language / ?lang=,
covering zh/en for every user-visible failure:
- 431 respondError sites well-shaped (was 281); English-only literals
  in c2/chat_uploads/webshell/notification/async_agent_runs and
  vulnerability_retest now carry zh translations
- prefix+err.Error() concat sites folded into respondErrorf
- upstream-extracted async runners (runSingleJSON/runMultiJSON/
  runWorkflowJSON/executeAcceptedRunBody) now thread wantEnglish,
  captured before the goroutine starts
- upstream tests updated for the new signatures

Frontend: settingsAudit.msg merged into all three locales; audit.js
maps stored-text to i18n keys; knowledge.js knowledgeT guard hardened;
test slice markers made line-ending tolerant (CRLF checkouts).

Co-Authored-By: Claude Code <noreply@anthropic.com>
- chat-i18n-keys.test.cjs: every chat.js key via chatTranslate /
  conversationSidebarText / window.t must exist in zh-CN, en-US, ru-RU
- all-i18n-keys.test.cjs: same contract for all web/static/js/*.js,
  resolving helper-prefix short keys (xxxT -> 'ns.' + key) and treating
  ICU plural _one/_other pairs in en-US as satisfying the plain key
- fill ru-RU to full key parity with en-US/zh-CN (timeline, wechat,
  settings/workflows gaps: botTokenPlaceholder, botUsernamePlaceholder,
  inspectionRequired)
- add missing hitl keys in all locales: workflowPendingTitle,
  openConversation, submitFailed

330 frontend tests pass.

Co-Authored-By: Claude Code <noreply@anthropic.com>
i18n-migrate stats counts any Chinese line uncovered; most are comments,
console logs, keyed fallback-map entries, and keyed-with-fallback helper
calls spanning lines the line-level regex misses. audit-uncovered-context
takes +/-3 lines of context for the covered check, skips keyed
'ns.key': '中文' fallback-map entries, console, and trailing zh comments,
and prints per-file truly-uncovered sites (349 across 22 files after
filtering from 3929 raw).

Co-Authored-By: Claude Code <noreply@anthropic.com>
The i18n error migration inserted fmt.Sprintf calls into storage,
wechat_robot, workflow and workflow_run without importing fmt; go
build failed with 'undefined: fmt'. Add the import to each.

Co-Authored-By: Claude Code <noreply@anthropic.com>
respondError/respondErrorf never reference net/http symbols; the stray
import failed the build with 'imported and not used'.

Co-Authored-By: Claude Code <noreply@anthropic.com>
skills/*/SKILL.md frontmatter descriptions showed raw Chinese in the
Skills page ('内网域攻击:BloodHound…'). skillDisplayDescription already
had the seed-translation pattern (skills.seedDescriptions.<id>) but only
cyberstrike-eino-demo was ever filled; user-edited descriptions stay as
original text by design.

- fill SEED_SKILL_DESCRIPTIONS in skills.js with all 23 seed skills'
frontmatter descriptions (exact-match gate)
- add skills.seedDescriptions.* to zh-CN (23), en-US (23, translated),
  ru-RU (23, en values as ru fallback per repo convention)

330 frontend tests pass.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Skill cards showed raw frontmatter tags ('渗透测试', '红队'). Add
skillDisplayTag with the seed-translation pattern used for descriptions:
seed tag values map to skills.seedTags.<tag> and translate; non-seed or
user-edited values render as-is.

- zh-CN: 渗透测试 / 红队 / 项目黑板 (identity)
- en-US: penetration-testing / red-team / project blackboard
- ru-RU: en values as ru fallback per repo convention

330 frontend tests pass.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Rename Chinese-named role YAML files to English names, translate
descriptions, user prompts, tool descriptions and seed skill tags.
Chinese docs preserved as tools/README_CN.md.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Localize fmt.Errorf, zap logger messages and handler responses by
request language (respondError/respondErrorf/i18nText dual-accept).
Protocol and wire markers (toolGuardBlockedPrefix, prepare.go
validation errors matched by multiAgentHTTPErrorStatus, historical
DB prefixes) stay byte-identical Chinese; frontends dual-accept.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Fill en-US/ru-RU i18n keys (contract over all frontend JS), translate
hardcoded Chinese UI strings, and dual-accept legacy Chinese text
(execution-failed prefixes, role default, c2 events) for historical
rows. Front .test.cjs suites pass.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Translate top-level README (Chinese preserved as README_CN.md),
CHANGELOG, docs/zh-CN pages, Burp Java extension labels, and the
browser-extension panel.

Co-Authored-By: Claude Code <noreply@anthropic.com>
The translated description contains ": " sequences which YAML cannot
parse as a plain scalar (mapping values are not allowed), breaking
skill loading with getRunFunc error. Quote it as a single-quoted
scalar so parsing succeeds again.

Co-Authored-By: Claude Code <noreply@anthropic.com>
applyTranslations skipped any element with child elements (e.g. the
new-project label "项目名称 <span class=required>*</span>"), leaving
the hardcoded Chinese fallback on screen in English sessions. Replace
only the leading text node so child elements like the required marker
are preserved while the label itself translates.

Co-Authored-By: Claude Code <noreply@anthropic.com>
The eino_single streaming loop sent two hardcoded Chinese progress
events ("正在启动 Eino ADK 单代理…", "已合并用户补充与最新轨迹…"),
so English sessions showed Chinese in the progress timeline when
starting a pentest. Emit English instead, add
progress.startingEinoSingleAgent / progress.mergedTraceContinuing keys,
and map the legacy Chinese text in translateProgressMessage for
historical rows (dual-accept).

Co-Authored-By: Claude Code <noreply@anthropic.com>
- All Chinese inline comments, doc blocks and trailing comments translated
- Remaining t()/fallback literals translated in place
- Multiline prompt templates (projects.js attack-chain etc.) translated
  with \${placeholder} preservation
- Functional regexes made dual-accept: keep legacy Chinese alternatives
  for old rows and add English alternatives (assets sheet/backend
  messages, chat executeFailed/callOpenAIFailed, webshell dir/ls parsing,
  monitor timeout/guard-block/soft-wait, knowledge not-enabled,
  hitl destructive-score)
- knowledge.js data-i18n text nodes set to English defaults
- mobile-ui.js pure-increment layer docs translated

Co-Authored-By: Claude Code <noreply@anthropic.com>
…gacy

The frontend checked `=== 'Processing...' || === 'Processing...'` (both arms
identical), so backend rows still holding the legacy Chinese placeholder
"处理中..." displayed raw Chinese as the assistant message body. Make those
checks dual-accept both values (chat.js x3, monitor.js x2), and write the
English placeholder "Processing..." for new rows (agent.go, multi_agent_
prepare.go); old Chinese rows keep matching everywhere via dual-accept.

Co-Authored-By: Claude Code <noreply@anthropic.com>
The startup banner line "任务进程隔离已就绪" still logged in Chinese;
translate it and the remaining fatal/log lines in main.go. Old
log.Fatal call sites switched from "error" key style to zap.Error.

Co-Authored-By: Claude Code <noreply@anthropic.com>
The MCP monitor status filter (monitor-status-filter) displayed the raw
Chinese template copy ("全部" etc.) because initMonitorFilterSelects
snapshot the <option> textContent into the custom trigger/dropdown
before i18n applies translations; it only re-synced on languagechange.
Re-sync once from window.i18nReady so the filter renders in the active
language immediately.

Also fix detectInitialLang/audit/hitl locale fallbacks reading only
navigator.language; fall back to navigator.languages[0] so an English
browser with no stored preference defaults to en-US instead of
DEFAULT_LANG zh-CN.

Co-Authored-By: Claude Code <noreply@anthropic.com>
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