Skip to content

l10n(zh): translate the supplement catalogue, so 300 strings stop falling back to English - #722

Merged
abdulsaheel merged 2 commits into
OpenStrap:mainfrom
kurexw:l10n/zh-supplement
Nov 15, 2026
Merged

abdulsaheel merged 2 commits into
OpenStrap:mainfrom
kurexw:l10n/zh-supplement

Conversation

@kurexw

@kurexw kurexw commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Chinese had none of the 300 supplement* strings that were added on Oct 7 (cc9dc10). de, ru and th have them. In a Chinese app these fell back to English across notifications ("Did you nap?", "Your recovery is ready"), progress lines ("Need {n} more nights", "Wear {n} more days to unlock"), the coach's action confirmations, lab marker names, chart descriptions for screen readers, and the metric explanations.

chinese_coverage_test already listed this as "Still to do: the supplement catalogue" and exempted it. This change translates all 300 and removes the exemption, so a future English-only key fails the test instead of silently showing English.

Terms follow what app_zh.arb already uses: 手环, 消耗 (strain), 恢复, 心率变异性 (HRV), 静息心率, 常规范围, 训练, 日志, 生命体征, 简报 (briefing), and 你. Units are written as words (千克, 公里, 千卡, 分钟), as the existing strings do. Units and method citations (Cole–Kripke, Plews 2013, AN-2554…) keep their names, as in de and ru.

The new entries are appended at the end of app_zh.arb, and no existing line changed.

Testing

  • chinese_coverage_test: the stricter test fails on main (300 missing) and passes with this change. A new case pins two of the strings.
  • A script check: same 300 keys as English, and every string has exactly the same {placeholders}.
  • ui2_screen_sweep_test (14 screens × 8 locales × 1.0/2.0/3.1× text): no overflows.
  • The test files that use the Chinese locale pass, together with the sweep (181 tests).
  • flutter gen-l10n and flutter analyze are clean.

I'm not a native speaker. A quick read by someone who is would help, especially the longer metric explanations.

Risks and rollback

Strings only, no code paths. Revert the commit to roll back.

Checklist

  • Same keys and placeholders as English
  • Coverage test tightened, and fails without the change
  • Large-text sweep clean in every locale
  • Analyze clean

Spanish is #720 and French is #721; Hindi follows separately.

🤖 Generated with Claude Code

Summary by Sourcery

Complete the Chinese supplement catalogue and enforce full English-to-Chinese localization coverage.

Bug Fixes:

  • Add Chinese translations for the complete supplement catalogue, preventing 300 user-facing strings from falling back to English.

Enhancements:

  • Expand Chinese localization coverage to include supplement notifications, progress messages, coach confirmations, lab markers, accessibility descriptions, and metric explanations.

Tests:

  • Require Chinese localization coverage for every English string and add regression checks for representative supplement translations.

Summary by CodeRabbit

  • Localization
    • Added Chinese translations for device and status explanations, charts, metrics, coaching actions, health observations, workout and sleep guidance, notifications, and accessibility labels.
    • Added Chinese descriptions of measurement methods and limitations, including step counting, recovery scores, sleep and heart-rate calculations, and sensor data availability.
    • The existing firmware-lock message remains unchanged.

…ling back to English

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

UI

Add the Chinese translations for the supplement catalogue so these user-facing strings no longer fall back to English.

  • lib/l10n/app_zh.arb L3491-3791

Tests

Require complete Chinese coverage of English strings and add checks for representative supplement translations.

  • test/chinese_coverage_test.dart L16, L25 (removed lines), L28-35

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters: 1

  • test/chinese_coverage_test.dart is excluded by !test/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

Run configuration

  • Source mode: Auto
  • Repository: OpenStrap/edge
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: b8fbe00
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 76df5f20-a2da-4870-a966-2769a122c9da

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.

Walkthrough

The Chinese localization resource adds interface strings and explanations for device status, health and activity metrics, sleep, measurement methods, and coaching actions and errors.

Changes: Chinese localization

Layer / File(s) Summary
Interface and measurement strings
lib/l10n/app_zh.arb
Adds Chinese labels, accessibility text, health and activity descriptions, measurement-method explanations, sleep and device-status guidance, and coaching messages. Includes a step-counting explanation and error messages for unsupported or non-JSON responses.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • OpenStrap/edge#705: Adds Chinese translations in the same localization file and updates translation-coverage tests. PR #722 translates the remaining supplement catalogue strings and updates the same coverage state.

Suggested reviewers: abdulsaheel, sourcery-ai

Merge Risk: Minimal · up to c0b16

Merge Risk: ⚪ Minimal · up to c0b16

This adds Chinese translations for about 300 strings that previously fell back to English. The change is purely additive and easy to revert, so merge risk is minimal. A native-speaker review of translation quality would still be worthwhile.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Inconclusive The title states the main change: Chinese translations for the supplement catalogue, so 300 strings no longer fall back to English. The raw summary describes Chinese ARB additions for device, chart, c… Confirm that the changeset adds the 300 supplement* strings to lib/l10n/app_zh.arb. The raw summary lists other topics (device status, coach actions, sleep guidance) and does not mention supplements. If the supplement strings are present, t…
Passed Passed checks: 3 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.
Full details: Title check

Explanation

The title states the main change: Chinese translations for the supplement catalogue, so 300 strings no longer fall back to English. The raw summary describes Chinese ARB additions for device, chart, coach, health, and measurement strings. It does not mention supplement strings, so the title does not match the changeset as summarized. The PR objectives do describe 300 supplement* strings added to app_zh.arb, which conflicts with the file-level summary. The summary covers the same ARB file, so the title is plausibly related, but the summary and objectives disagree on which strings were added.

Resolution

Confirm that the changeset adds the 300 supplement* strings to lib/l10n/app_zh.arb. The raw summary lists other topics (device status, coach actions, sleep guidance) and does not mention supplements. If the supplement strings are present, the title is accurate and no change is needed. If the file-level summary is correct, update the title to match the strings actually added.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: OpenStrap/edge
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: b8fbe00
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 0183fd88-e7fb-4ce6-b0dc-3c886a5d58df
Commits

Reviewing files that changed from the base of the PR and between b8fbe00 and 8e9650d.

Files ignored due to path filters: 1

  • test/chinese_coverage_test.dart is excluded by !test/**
Files selected for processing: 1

  • lib/l10n/app_zh.arb

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="test/chinese_coverage_test.dart" line_range="29-30" />
<code_context>
   });

+  test('the supplement catalogue reads in chinese', () {
+    expect(zh.supplementNeedNights(3), '还需要 3 个晚上');
+    expect(zh.supplementNeedDays(2), '再佩戴 2 天即可解锁');
+    expect(zh.supplementDidYouNapccbced, isNot(en.supplementDidYouNapccbced));
+  });
</code_context>
<issue_to_address>
**Placeholder values can be hard-coded**

When a getter is changed to ignore its argument and return the tested literal, `the supplement catalogue reads in chinese` still passes at lines 29–30 if either getter ignores its argument and returns the tested literal: each input matches the number in the expected string. Callers using other counts then get incorrect progress text.

Assert each getter's output for at least one additional count with a matching expected string.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: test/chinese_coverage_test.dart:30


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment on lines +29 to +30
expect(zh.supplementNeedNights(3), '还需要 3 个晚上');
expect(zh.supplementNeedDays(2), '再佩戴 2 天即可解锁');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Placeholder values can be hard-coded

When a getter is changed to ignore its argument and return the tested literal, the supplement catalogue reads in chinese still passes at lines 29–30 if either getter ignores its argument and returns the tested literal: each input matches the number in the expected string. Callers using other counts then get incorrect progress text.

Assert each getter's output for at least one additional count with a matching expected string.

Prompt for AI agents
In `test/chinese_coverage_test.dart` at lines 29-30:

**Placeholder values can be hard-coded**

When a getter is changed to ignore its argument and return the tested literal, `the supplement catalogue reads in chinese` still passes at lines 29–30 if either getter ignores its argument and returns the tested literal: each input matches the number in the expected string. Callers using other counts then get incorrect progress text.

Assert each getter's output for at least one additional count with a matching expected string.

@abdulsaheel
abdulsaheel merged commit e1bd9d3 into OpenStrap:main Nov 15, 2026
10 checks passed
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.

2 participants