Repository navigation
Conversation
Cookie-driven locale (NEXT_LOCALE, en default) across all pages, shared components, charts, error messages, import diagnostics, AI replies, dictation, and the PDF/PNG review export. Machine contracts (CSV/JSON exports, import parsing, URL/query params, DB schema, auth) are unchanged; server errors gain an optional stable `code` field and importers an optional `diagnostics[]` so clients can localize without parsing English text. Includes per-locale fonts (Noto Sans SC/TC/JP/KR, SIL OFL 1.1), a seven-locale message-integrity gate, and a rich-text tag contract test. Behavior contract and maintenance guide: docs/i18n.md.
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.
What & why
Complete interface localization in seven languages — English (default), Simplified Chinese, Japanese, Korean, Traditional Chinese, Spanish, and French — covering all 16 pages, shared components, charts, error messages, import diagnostics, AI responses, voice dictation, and the PDF/PNG review export.
Self-hosted users outside English-speaking markets currently get a fully English UI. This makes the whole journal usable in their language while leaving every machine-facing contract untouched.
Design
NEXT_LOCALEcookie instead of URL prefixes, so existing URLs, bookmarks, and filter query params are unaffected. First visit uses the default (en); noAccept-Languagesniffing.apps/web/messages/<locale>/<namespace>.json— 28 namespaces × 7 locales (~2,000 keys per locale), merged per request and injected through a singleNextIntlClientProviderin the root layout.html langand metadata follow the cookie. The switcher lives in Settings → General (single entry point, product decision).Intlwith the active locale. Storage and machine formats stay exactly as they were.{ error }text as the stable machine identifier and gain an optionalcode(plus optionalparams) so clients can localize without regex-matching English prose. Status codes and auth behavior are unchanged; the existing English-text matching inlib/ai-feedback.tsstill works as before.diagnostics[]({ code, params }) alongside the existing Englishwarnings/errors; detection and rejection rules are untouched.What does NOT change
/api/localeis the only addition to the public path list, and it only writes the language cookieDependencies
next-intl@4.14.9,date-fns@^4.4.0,@formatjs/icu-messageformat-parser@^3.5.20— all MIT, all passscripts/check-licenses.mjs. Four Noto Sans CJK fonts (SIL OFL 1.1) with license files underapps/web/public/fonts/.Testing
apps/web/tests/helpers/i18n.tsx); nothing depends on the developer machine's language or timezone.pnpm check:messages(key sets, ICU parsing, parameter parity, and plural categories across all 7 locales) and a rich-text contract test that scans everyt.rich()call site for matching tags in every locale.docs/i18n.md§19: real-model AI reply language, real-browser speech-recognition support, and a narrow-viewport visual pass.Review guide
Suggested reading order:
apps/web/src/i18n/config.tsandapps/web/src/i18n/request.ts— locale enum, cookie resolution, per-request message merge (paths are built only from the validated enum)docs/i18n.md— the behavior contract: switching rules, error strategy, machine-format boundaries, seven-language glossaryapps/web/src/server/api.ts+apps/web/src/middleware.ts— the only protocol deltas are the optionalcode/paramsfields and the public/api/localeroute (~40 lines)scripts/check-messages.mjs+apps/web/tests/i18n-rich-tags.test.ts— the two gatesuseTranslationsconversionsdocs/i18n.mdis the long-term maintenance entry point — adding an 8th language is a config + catalog + glossary change with no business-code edits.