Repository navigation
feat: add Japanese and Simplified Chinese UI languages - #147
Conversation
Settings -> Language gains 日本語 and 简体中文. System now picks the browser's first translated language (any zh tag maps to Simplified Chinese). Dictionaries are looked up by language, <html lang> and Intl dates use the full locale tag, and the dictionary tests run over every language. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configurationConfiguration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (11)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe application adds Japanese and Simplified Chinese language support. Browser language resolution selects a supported language, and locale tags are used for document language and date and time formatting. ChangesLanguage support
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Merge Risk: ⚪ Minimal · up to The language changes are mergeable on the available evidence; browser language selection matches the documented behavior. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The new languages use fixed translation and locale mappings, and the inspected language-selection paths do not change authentication or other privileged actions. Some integration paths have not been exhaustively verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 53.85% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 8 files. (3 skipped: 3 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Agent, Token, Skill, Star, bridge and Issue stay English where developers see them that way in their tools; pane is 窗格 so it no longer collides with 命令面板, and prompt cards read as question cards like the Korean. Co-Authored-By: Claude Opus 5.5 <[email protected]>
## Change Settings → Alerts now has **Send test** for this device's existing push subscription. It distinguishes sent, missing subscription and failed delivery, and offers explicit re-enabling when the subscription is missing. Testing does not silently repair a stale subscription or enable alerts that were switched off. Settings → Phone adds **Keep screen on**, off by default. It requests a screen wake lock while a terminal or chat pane is open, releases it on hiding/sign-out/no pane, and reacquires it when the page returns. Late requests are released after cleanup; unsupported browsers and browser refusal leave the app usable. Closes #138. Closes #137. Depends on #147: this PR is based on `feat/i18n-ja-zh` and includes Korean, Japanese and Simplified Chinese translations for the new controls. The Screen Wake Lock lifecycle follows the [W3C API](https://www.w3.org/TR/screen-wake-lock/). ## Validation - `bun run generate:types --check`, `bun run typecheck`, `bun run build` — pass. - `bun run test:unit` — 431 pass. - `bun run test:integration` — 121 pass, isolated herdr session. - `bun scripts/ui-regression.ts` — pass, including push success/404/502/local-missing/recovery/off and wake-lock opt-in/hide/return/persistence/refusal/unsupported/no-pane checks. - `bun scripts/file-viewer-regression.ts` — pass. - Push service and wake-lock browser APIs are controlled stand-ins in the new browser scenarios; real API contracts remain covered by integration tests. No HTTP/WS contract changes. - The prerequisite #147 was also checked at 1280, 390 and 320 px for Japanese/Chinese/Korean/English switching, persistence and horizontal overflow. Its screenshots are included alongside the device-settings evidence. Screenshots from isolated test sessions:  | Mobile push failure | Keep screen on | | --- | --- | |  |  |
## Change With Language set to **System**, the resolver scans `navigator.languages` but only recognizes `ko`, `ja`, and `zh`. English is used only as the final fallback, so an English-first browser such as `["en-US", "ja-JP"]` unexpectedly gets Japanese. This can appear to follow the device's region rather than its preferred language. - Recognize `en` alongside the other supported languages, preserving browser preference order. - Update the resolver comment and the existing expectations that encoded the incorrect behavior. - Add regressions for English before Japanese/Korean/Chinese, English with a Japanese region (`en-JP`), case-insensitive matching, non-English-first preferences, unsupported-language skipping, and the English fallback. - Add a user-facing entry under Unreleased → Fixed; no version bump. Explicit language overrides and the existing Simplified Chinese mapping are unchanged. No settings, dictionaries, components, styles, HTTP/WS contracts, or demo transport changes are needed: this fixes the shared client-side selection function only. Searched upstream issues and PRs for language, locale, navigator.languages, and system-language priority. No duplicate fix was found. PR #147 documents the previous first-*translated*-language policy; this fix selects the first *supported* language, including English. This is a small fix submitted directly under CONTRIBUTING.md, without a separate issue. ## Validation - Regression-first check: the updated i18n suite failed in three tests before the resolver fix. - `HERDR_TEST_MODE=unit bun test ./src/lib/i18n.test.ts`: **16 pass, 0 fail** after the fix. - `bun run generate:types --check`: passed. - `bun run typecheck`: passed. - `bun run build`: passed; Vite reports its bundle-size warning (a minified chunk exceeds 500 kB). - `bunx [email protected] run test:unit` (the documented CI Bun version): **1,416 pass, 4 skip, 0 fail** across 122 files. - `git diff --check`: passed. The host's Bun 1.4.0 initially produced **1,415 pass, 4 skip, 1 fail**: the untouched `server/voice.test.ts` expects an uploaded filename of `audio.webm` but receives `clip.webm`. That failure also reproduces when the unchanged voice test runs alone; the complete suite passes on CI's Bun 1.4.2. No unrelated source or test was changed to suppress it. Integration/browser suites and macOS Safari were not run. This is a pure language-selection logic fix with no visual/layout changes; there is no screenshot or recording attached. The relevant ordered browser-language inputs are covered directly by regression tests. --------- Co-authored-by: e2e <[email protected]>
Change
src/lib/i18n.ja.tsandsrc/lib/i18n.zh.tsmirrori18n.ko.tskey-for-key (491 entries each).Systemfollows the browser's first translated language (ko/ja/zh); any Chinese tag, zh-TW included, maps to Simplified Chinese.i18n.tslooks strings up per language;LANGUAGE_SETTINGSandLOCALE_TAGSare defined once and drive settings parsing, the settings picker,<html lang>(ja-JP,zh-CN) and Intl date/time formatting (ChatView, DevicesPanel).Validation
bun test: 541 passbun run typecheckbun run generate:types --checkbun run build285da3d.Screenshots from the owned test session (preserved by the follow-up device-settings PR):