Skip to content

feat: add Japanese and Simplified Chinese UI languages - #147

Merged
devswha merged 4 commits into
mainfrom
feat/i18n-ja-zh
Sep 29, 2026
Merged

devswha merged 4 commits into
mainfrom
feat/i18n-ja-zh

Conversation

@devswha

@devswha devswha commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Change

  • Settings → Language adds 日本語 and 简体中文 next to English and 한국어.
  • New dictionaries src/lib/i18n.ja.ts and src/lib/i18n.zh.ts mirror i18n.ko.ts key-for-key (491 entries each).
  • System follows the browser's first translated language (ko / ja / zh); any Chinese tag, zh-TW included, maps to Simplified Chinese.
  • i18n.ts looks strings up per language; LANGUAGE_SETTINGS and LOCALE_TAGS are defined once and drive settings parsing, the settings picker, <html lang> (ja-JP, zh-CN) and Intl date/time formatting (ChatView, DevicesPanel).
  • On narrow phones the language segmented control wraps instead of overflowing.
  • The dictionary tests (missing, stale, placeholders, untranslated) now run for Korean, Japanese and Chinese.

Validation

  • bun test: 541 pass
  • bun run typecheck
  • bun run generate:types --check
  • bun run build
  • Chromium browser QA at 1280, 390 and 320 px in an isolated test session: Japanese, Simplified Chinese, Korean and English switch correctly; the translated dialog title and document language update without horizontal overflow. Japanese persists after reload. No browser page errors. Checked commit 285da3d.

Screenshots from the owned test session (preserved by the follow-up device-settings PR):

Japanese, 390 px Simplified Chinese, 320 px
Japanese mobile Simplified Chinese narrow viewport

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]>
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration

Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 05b8ac67-0cf1-4b7f-b896-a1ea04d5c371

📥 Commits

Reviewing files that changed from the base of the PR and between 285da3d and 5e4de27.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6be9f2c7-7ea8-4d12-b25b-1ba319478c6b

📥 Commits

Reviewing files that changed from the base of the PR and between c1792fa and 285da3d.

📒 Files selected for processing (11)
  • CHANGELOG.md
  • docs/guide.md
  • src/components/ChatView.tsx
  • src/components/DevicesPanel.tsx
  • src/components/SettingsDialog.css
  • src/components/SettingsDialog.tsx
  • src/lib/i18n.ja.ts
  • src/lib/i18n.test.ts
  • src/lib/i18n.ts
  • src/lib/i18n.zh.ts
  • src/lib/settings.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Summary

Summary by CodeRabbit

  • New Features
    • Added Japanese and Simplified Chinese as interface language options, with translated text across the app.
    • In system language mode, the first supported browser language determines the interface language and date/time formatting. Chinese regional settings use Simplified Chinese.
  • Improvements
    • Settings controls now wrap on narrow screens instead of overflowing.
    • Updated the available-language list in the feature guide.

Walkthrough

The 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.

Changes

Language support

Layer / File(s) Summary
Language resolution and translations
src/lib/i18n.ts, src/lib/i18n.*.ts, src/lib/i18n.test.ts, CHANGELOG.md, docs/guide.md
The i18n module supports Japanese and Simplified Chinese, resolves browser language preferences in order, and exposes locale tags. Japanese and Chinese dictionaries and related translation and resolution tests are added. Documentation lists the added languages.
Language settings integration
src/lib/settings.ts, src/components/SettingsDialog.tsx, src/components/SettingsDialog.css
Settings validation and the language selector use the shared supported-language list. The document language uses its locale tag, and segmented controls wrap on narrow screens.
Locale-based date and time formatting
src/components/ChatView.tsx, src/components/DevicesPanel.tsx
Chat timestamps and device last-seen dates use the active locale.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 285da

The language changes are mergeable on the available evidence; browser language selection matches the documented behavior.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 285da

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
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected browser-controlled input can change presentation language and locale across the client UI, but cannot supply an arbitrary dictionary keyspace or locale tag through language resolution.

Trust Boundaries and Controls

  • inferred — Supported-value validation constrains persisted settings, and the inspected pairing and authentication handlers remain separate from translated labels. This does not establish coverage of every rendering sink.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: adding Japanese and Simplified Chinese UI languages.
Description check ✅ Passed The description includes the required Change and Validation sections. It explains the behavior, lists validation results, and provides UI screenshots from a test session.
Full details: Docstring Coverage

Explanation

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 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

devswha and others added 2 commits September 29, 2026 14:52
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]>
@devswha
devswha merged commit cd46b9f into main Sep 29, 2026
3 checks passed
@devswha
devswha deleted the feat/i18n-ja-zh branch September 29, 2026 06:27
devswha added a commit that referenced this pull request Sep 29, 2026
## 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:

![Desktop test
notification](https://raw.githubusercontent.com/devswha/herdr-web-ui/eee87d0/docs/screenshots/device-settings/push-test-desktop.png)

| Mobile push failure | Keep screen on |
| --- | --- |
| ![Mobile push
failure](https://raw.githubusercontent.com/devswha/herdr-web-ui/eee87d0/docs/screenshots/device-settings/push-test-mobile.png)
| ![Keep screen
on](https://raw.githubusercontent.com/devswha/herdr-web-ui/eee87d0/docs/screenshots/device-settings/keep-screen-on-mobile.png)
|
devswha pushed a commit that referenced this pull request Oct 6, 2026
## 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]>
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