Global-ready: content language follows the reader + English code comments - #3
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsresolves the language for LLM-generated content (topic labels, summaries, social context, the weekly reading digest, the cover concept):USER_CONFIG.contentLanguage, when set and not"auto";pages.lang, when enough pages carry a real language tag;Generator prompts (
enrich,digest,cover) are now English templates that emit output in the resolved language; image-generation prompts stay English.userConfiggainscontentLanguage: "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