Skip to content

fix(prompts): localize web report item labels for English mode#410

Open
nankingjing wants to merge 4 commits into
gsscsd:mainfrom
nankingjing:fix/web-prompt-en-localization
Open

fix(prompts): localize web report item labels for English mode#410
nankingjing wants to merge 4 commits into
gsscsd:mainfrom
nankingjing:fix/web-prompt-en-localization

Conversation

@nankingjing

Copy link
Copy Markdown

Problem

buildWebReportPrompt in src/prompts.ts uses hardcoded Chinese labels for item fields, regardless of the lang parameter. When English reports are generated (lang="en"), the prompt leaks Chinese text:

  • Item field labels: 分类, 发布/更新, 内容节选, 未知
  • Empty-section message: 暂无可供分析的内容
  • Section wrapper uses full-width Chinese parentheses (...)

This happens inside the siteSections builder (lines 593-606), which runs before the language-branching return statement. The lang parameter is available but not consulted for these strings.

Fix

Add English-localized strings for the three affected locations, guarded by the lang parameter:

  1. Empty-items message — provides an English alternative: (mode, no content available for analysis.)
  2. Item field labels — uses Category/Published/Updated/Unknown/Excerpt when lang="en"
  3. Section header parens — uses standard ASCII parentheses (...) for English

Verification

  • Reproduction script (run with npx tsx): before fix, English output contained Chinese characters; after fix, clean English.
  • No behavioral change for the default lang="zh" path.
  • TypeScript: npx tsc --noEmit passes (verified locally).

@nankingjing

Copy link
Copy Markdown
Author

Reviewed — itemLabels i18n is cleanly structured, covers all label keys and the empty/no-content messages. Ready for review.

@nankingjing

Copy link
Copy Markdown
Author

Re-reviewed and fixed the section header spacing: the Chinese lang="zh" path now keeps the original full-width parentheses without an extra leading space, while English uses ASCII parentheses with a leading space. Local tsc --noEmit, eslint src, and focused prompt-output tests pass; CI run is still blocked pending workflow approval.

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