Skip to content

Global-ready: content language follows the reader + English code comments - #3

Merged
howieyoung merged 2 commits into
mainfrom
feat/global-ready
Aug 8, 2026
Merged

Global-ready: content language follows the reader + English code comments#3
howieyoung merged 2 commits into
mainfrom
feat/global-ready

Conversation

@howieyoung

Copy link
Copy Markdown
Owner

Makes the project global-facing. (Replaces #2, which GitHub auto-closed when #1's base branch was deleted on merge.)

1 · Content language follows the reader (with an override)

New src/locale.ts resolves the language for LLM-generated content (topic labels, summaries, social context, the weekly reading digest, the cover concept):

  1. explicit override — USER_CONFIG.contentLanguage, when set and not "auto";
  2. dominant pages.lang, when enough pages carry a real language tag;
  3. a zero-dependency script heuristic (kana → Japanese, hangul → Korean, other CJK → Chinese, Latin → English) over recent reading — Chrome/extension language tags are frequently empty;
  4. English as the ultimate fallback.

Generator prompts (enrich, digest, cover) are now English templates that emit output in the resolved language; image-generation prompts stay English. userConfig gains contentLanguage: "auto" as the per-user override.

2 · Code comments → English

All Chinese code comments across the repo are translated to concise English. Comments only — every string literal (UI labels, console messages, errors, prompts) is byte-identical.

Verification

typecheck, the 18 security-invariant tests, and the security grep-gates all pass; a string-survival check confirms the comment sweep left string literals untouched.

🤖 Generated with Claude Code

howieyoung and others added 2 commits August 8, 2026 19:44
Make generated content global-ready. A new src/locale.ts resolves the language
for LLM-generated content (topic labels, article summaries, social context, the
weekly reading digest, the cover concept):

  1. explicit override — USER_CONFIG.contentLanguage, when set and not "auto"
  2. dominant pages.lang, when enough pages carry a real language tag
  3. a zero-dep script heuristic (kana/hangul/CJK/Latin) over recent reading,
     since Chrome/extension language tags are frequently empty
  4. English as the ultimate fallback

The generator prompts (enrich, digest, cover) are now English templates that emit
their output in the resolved language; image-generation prompts stay English
regardless (image models expect English). userConfig gains contentLanguage: "auto"
as the per-user override channel (a BCP-47 code or a plain language name).

No behavior change for existing readers whose content is already in one language
(the resolver returns that language); new content simply follows what they read.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Convert all Chinese code comments (// line, /* */ and /** */ JSDoc, SQL "--" in the
schema template, and "#" in shell/mjs) to concise, technically-accurate English across
the repo, so outside contributors can read the codebase.

Comments only: every string literal is left byte-identical — user-facing UI labels in
the rendered issue/email/showcase (still Chinese by design), console/operator messages,
thrown Error() messages, and LLM prompt strings. No code, identifiers, types, regex, or
logic changed. Verified: typecheck, the 18 security-invariant tests, and the security
grep-gates all pass; the Chinese UI/console strings all survive unchanged.

Not localized here (fixed UI chrome stays Chinese for now): the rendered section labels,
nameplate, and operator console messages — a separate follow-up if full UI localization
is wanted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@howieyoung
howieyoung merged commit bc4e659 into main Aug 8, 2026
2 checks passed
@howieyoung
howieyoung deleted the feat/global-ready branch August 8, 2026 11:59
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