Skip to content

fix(i18n): complete zh-CN onboarding translations#1981

Merged
senamakel merged 2 commits into
tinyhumansai:mainfrom
Monking-21:zh-cn-i18n-completeness
May 17, 2026
Merged

fix(i18n): complete zh-CN onboarding translations#1981
senamakel merged 2 commits into
tinyhumansai:mainfrom
Monking-21:zh-cn-i18n-completeness

Conversation

@Monking-21
Copy link
Copy Markdown
Contributor

@Monking-21 Monking-21 commented May 17, 2026

Summary

  • Completes the Simplified Chinese translation map for the current onboarding/runtime-choice copy.
  • Adds missing zh-CN strings for Settings alerts, runtime selection, custom API key setup, custom wizard steps, and beta feedback.
  • Adds an i18n regression test that fails when zh-CN falls behind the English translation key set.

Problem

Solution

  • Added the missing Simplified Chinese strings in the same groups used by the English translation file.
  • Added a focused drift guard in I18nContext.test.tsx so future English keys must be added to zh-CN deliberately.
  • Left Indonesian fallback behavior unchanged; this PR only tightens zh-CN completeness.

Submission Checklist

If a section does not apply to this change, mark the item as N/A with a one-line reason. Do not delete items.

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy
  • Diff coverage ≥ 80% — N/A: translation-map data plus a focused i18n drift guard; CI coverage gate remains authoritative for changed lines.
  • Coverage matrix updated — N/A: i18n translation completeness does not add/remove/rename feature rows.
  • All affected feature IDs from the matrix are listed in the PR description under ## Related — N/A: no feature matrix IDs affected.
  • No new external network dependencies introduced (mock backend used per Testing Strategy)
  • Manual smoke checklist updated if this touches release-cut surfaces (docs/RELEASE-MANUAL-SMOKE.md) — N/A: translation copy only, no release smoke surface changed.
  • Linked issue closed via Closes #NNN in the ## Related section

Impact

  • Runtime/platform impact: frontend copy only; no Rust, Tauri, backend, or persistence changes.
  • User-visible effect: Simplified Chinese users see localized onboarding/runtime setup strings instead of English fallback text.
  • Performance/security/migration impact: none.

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Keep this section for AI-authored PRs. For human-only PRs, mark each field N/A.

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: zh-cn-i18n-completeness
  • Commit SHA: 22be22af

Validation Run

  • pnpm --filter openhuman-app format:check
  • pnpm typecheck
  • Focused tests: pnpm debug unit src/lib/i18n/__tests__/I18nContext.test.tsx
  • Focused review-fix tests: pnpm debug unit src/lib/i18n/__tests__/I18nContext.test.tsx
  • Lint: pnpm lint (exit 0; existing warning set remains)
  • Pre-push token lint: pnpm --dir app run lint:commands-tokens
  • Rust fmt/check (if changed): pnpm rust:check (exit 0; existing warning set remains)
  • Tauri fmt/check (if changed): covered by pnpm --filter openhuman-app format:check and pnpm rust:check

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: Simplified Chinese locale now covers the onboarding/runtime-choice key set instead of falling back to English for those strings.
  • User-visible effect: zh-CN users see localized setup and settings copy.

Parity Contract

  • Legacy behavior preserved: English and Indonesian translation fallback behavior remains unchanged.
  • Guard/fallback/dispatch parity checks: Added zh-CN key completeness guard against en.ts; no routing or dispatch logic changed.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): None found for Monking-21:zh-cn-i18n-completeness.
  • Canonical PR: This PR.
  • Resolution (closed/superseded/updated): N/A.

Summary by CodeRabbit

  • New Features

    • Added Simplified Chinese translations for alerts/notifications settings.
    • Expanded Chinese localization for onboarding flows, including runtime choices, API key setup, and advanced/custom setup steps.
    • Added Chinese copy for beta feedback.
  • Tests

    • Added a test that validates translation completeness to ensure no missing keys between English and Simplified Chinese.

Review Change Stack

@Monking-21 Monking-21 requested review from a team and Copilot May 17, 2026 02:35
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 97a4625d-baba-4bbf-829e-98ccae360db0

📥 Commits

Reviewing files that changed from the base of the PR and between cdba105 and 22be22a.

📒 Files selected for processing (1)
  • app/src/lib/i18n/__tests__/I18nContext.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/lib/i18n/tests/I18nContext.test.tsx

📝 Walkthrough

Walkthrough

This PR adds Simplified Chinese (zh-CN) translations and a test that verifies zh-CN includes all English translation keys. The zh-CN file adds settings alert strings, extensive onboarding content (runtime choice, API keys, custom onboarding steps for inference, voice, OAuth, search, memory), and a beta feedback string; a test asserts no missing keys.

Changes

Chinese Translation Updates

Layer / File(s) Summary
Simplified Chinese UI translations
app/src/lib/i18n/zh-CN.ts
Extends zh-CN with settings.alerts, settings.alertsDesc, onboarding keys for runtime choice, API keys, and custom onboarding wizard steps for inference, voice, OAuth (Composio), web search, and memory, plus misc.betaFeedback.
Locale completeness test
app/src/lib/i18n/__tests__/I18nContext.test.tsx
Imports en and zh-CN, adds unwrapTranslationMap to normalize translation maps, builds the set of English keys, and asserts that no keys are missing from the zh-CN map.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hop through keys both old and new,
Counting phrases, one, then two—
zh-CN blooms with every line,
Tests confirm the match is fine,
A carrot-coded cheer: well done!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding missing Simplified Chinese translations for the onboarding flow to complete localization coverage.
Linked Issues check ✅ Passed PR addresses #1947's Chinese localization request by completing zh-CN onboarding translations and adding regression test to maintain key alignment with English.
Out of Scope Changes check ✅ Passed All changes are in-scope: zh-CN translation additions, test file updates for i18n validation, and no unrelated modifications to other systems.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/src/lib/i18n/__tests__/I18nContext.test.tsx (1)

49-51: ⚡ Quick win

Strengthen drift guard to catch empty translations, not just missing keys.

This currently passes when a zh-CN key exists but is an empty string. Consider asserting both presence and non-empty values.

Proposed improvement
-    const missingKeys = Object.keys(en).filter(key => !(key in zhCN));
-
-    expect(missingKeys).toEqual([]);
+    const missingKeys = Object.keys(en).filter(
+      key => !Object.hasOwn(zhCN, key),
+    );
+    const emptyKeys = Object.keys(en).filter(key => {
+      const value = zhCN[key as keyof typeof zhCN];
+      return typeof value !== 'string' || value.trim().length === 0;
+    });
+
+    expect(missingKeys).toEqual([]);
+    expect(emptyKeys).toEqual([]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/lib/i18n/__tests__/I18nContext.test.tsx` around lines 49 - 51, The
test currently only checks that keys in `en` exist in `zhCN` (via
`missingKeys`), but misses cases where `zhCN` has an empty string; update the
assertion to also detect empty/blank translations by changing the filter to
require that `zhCN[key]` is a non-empty string (e.g., check `key in zhCN &&
typeof zhCN[key] === 'string' && zhCN[key].trim() !== ''`) or produce a separate
`emptyKeys` array for keys whose `zhCN` value is falsy/blank, and assert both
`missingKeys` and `emptyKeys` are empty in the `I18nContext.test.tsx` test.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@app/src/lib/i18n/__tests__/I18nContext.test.tsx`:
- Around line 49-51: The test currently only checks that keys in `en` exist in
`zhCN` (via `missingKeys`), but misses cases where `zhCN` has an empty string;
update the assertion to also detect empty/blank translations by changing the
filter to require that `zhCN[key]` is a non-empty string (e.g., check `key in
zhCN && typeof zhCN[key] === 'string' && zhCN[key].trim() !== ''`) or produce a
separate `emptyKeys` array for keys whose `zhCN` value is falsy/blank, and
assert both `missingKeys` and `emptyKeys` are empty in the
`I18nContext.test.tsx` test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0724e5e2-197f-4bd3-941a-cdc858cdaf2a

📥 Commits

Reviewing files that changed from the base of the PR and between 3b24821 and cdba105.

📒 Files selected for processing (2)
  • app/src/lib/i18n/__tests__/I18nContext.test.tsx
  • app/src/lib/i18n/zh-CN.ts

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 17, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Completes Simplified Chinese i18n coverage for onboarding/runtime-choice related copy and adds a regression guard intended to keep zh-CN aligned with English translation keys.

Changes:

  • Adds missing zh-CN translations for settings alerts, runtime selection, API key setup, custom onboarding, and beta feedback.
  • Adds a Vitest key-completeness check comparing zh-CN against English.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
app/src/lib/i18n/zh-CN.ts Adds Simplified Chinese translations for previously missing onboarding/settings keys.
app/src/lib/i18n/__tests__/I18nContext.test.tsx Adds a regression test for zh-CN translation key completeness.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/lib/i18n/__tests__/I18nContext.test.tsx Outdated
@senamakel senamakel merged commit 1ecb0e2 into tinyhumansai:main May 17, 2026
27 checks passed
AusAgentSmith pushed a commit to AusAgentSmith/openhuman that referenced this pull request May 23, 2026
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.

[Feature Request] 中文界面本地化 / Chinese UI Localization (i18n)

3 participants