Skip to content

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

Closed
howieyoung wants to merge 2 commits into
feat/local-archivefrom
feat/global-ready
Closed

Global-ready: content language follows the reader + English code comments#2
howieyoung wants to merge 2 commits into
feat/local-archivefrom
feat/global-ready

Conversation

@howieyoung

Copy link
Copy Markdown
Owner

Makes the project global-facing. Stacked on #1 (base branch feat/local-archive) — merge #1 first, then this retargets to main.

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

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-dependency script heuristic (kana → Japanese, hangul → Korean, other CJK → Chinese, Latin → English) over recent reading — because Chrome/extension language tags are frequently empty (in practice ~80% here);
  4. English as the ultimate fallback.

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

No behavior change for a reader whose content is already one language — the resolver returns that language; new content just follows what they actually read.

2 · Code comments → English

All Chinese code comments across the repo are translated to concise English so outside contributors can read the codebase. Comments only — every string literal is byte-identical: user-facing UI labels in the rendered issue/email/showcase, console/operator messages, thrown errors, and prompt strings.

Out of scope (deferred): the fixed UI chrome (rendered section labels, nameplate, html lang) stays Chinese for now — a separate follow-up if full UI localization is wanted.

Verification

  • typecheck, the 18 security-invariant tests, and the security grep-gates all pass.
  • String-survival check confirms the Chinese UI/console strings are untouched by the comment sweep.
  • Resolver verified end-to-end (returns the reader's language; digests regenerated in-language at the tuned length).

🤖 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 deleted the branch feat/local-archive August 8, 2026 11:57
@howieyoung howieyoung closed this Aug 8, 2026
@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