Repository navigation
l10n: translate the ChatGPT sign-in flow and an alarm status, which showed English in every language - #726
Conversation
…hod text, which every language showed in English since Oct 2 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…howed English in every language Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewer's GuideData structuresAdd the English and translated catalogue entries for the alarm status and ChatGPT sign-in flow.
ImplementationMap the affected English literals to their catalogue entries, reusing the existing Cancel translation.
TestsAdd a guard that scans translation-helper calls and fails when their literals remain untranslated in German, Russian, and Thai.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 21 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="test/ui_text_literals_translated_test.dart" line_range="47" />
<code_context>
+ ].join().replaceAll(r"\'", "'").replaceAll(r'\"', '"');
+ // Interpolated text can't be looked up verbatim; it is translated
+ // through its own message, not through this map.
+ if (text.contains(r'$') || text.trim().isEmpty) continue;
+ checked++;
+ String tr(AppLocalizations l) => m.group(1) == 'presentationText'
</code_context>
<issue_to_address>
**Sign-in errors remain English**
When a sign-in attempt fails with a ChatGptException, when ChatGPT sign-in fails, `_signInChatGpt` stores `ChatGptException.message` directly in `_msg`, and `coachPresentationText` returns unrecognized messages unchanged. Browser, timeout, and OAuth errors therefore remain English for users in other languages despite the claim to translate the sign-in flow.
Localize the user-facing ChatGPT sign-in errors, for example by using localized error keys at the presentation boundary.
</issue_to_address>
### Comment 2
<location path="lib/l10n/display_text.dart" line_range="132" />
<code_context>
"Threshold" => l.activityZonesNameThreshold,
"Max effort" => l.activityZonesNameMaxEffort,
+ "Saved, but the band hasn't taken it yet — it's sent again on the next sync" =>
+ l.alarmSavedNotOnBand,
+ "Using ChatGPT plan" =>
+ l.coachChatgptUsingPlanShort,
</code_context>
<issue_to_address>
**Old-language status remains visible**
When the app locale changes after a coach status is stored or while an alarm write is pending, `_msg` stores already-localized coach status text, and `notOnBand` is captured before the alarm write awaits. After a locale change, `coachPresentationText` cannot map the old translated string back to the new locale, while the alarm handler displays its captured string directly, so the user sees the status in the previous language.
Keep canonical English status text in state and localize it at render or failure-display time using the current locale.
Also at `lib/l10n/display_text.dart:136`, `lib/l10n/display_text.dart:139`, `lib/l10n/display_text.dart:141`.
</issue_to_address>
### Comment 3
<location path="test/ui_text_literals_translated_test.dart" line_range="21" />
<code_context>
+import 'package:openstrap_edge/l10n/presentation_text.dart';
+
+final _call = RegExp(
+ r"""\b(uiText|localizedText|presentationText)\(\s*[\w.?!]+\s*,\s*((?:'(?:[^'\\]|\\.)*'\s*|"(?:[^"\\]|\\.)*"\s*)+)\)""",
+);
+final _piece =
</code_context>
<issue_to_address>
**Untranslated copy escapes the guard**
When a translation-helper call uses a nested expression such as `AppLocalizations.of(c)` for its first argument, `_call` accepts only `[�w.?!]+` as its first argument, so it omits the call and the test passes without checking its literal; untranslated English copy can reach users in other languages.
Update the call matcher to handle nested expressions in the first argument so it checks these literals.
Also at `test/ui_text_literals_translated_test.dart:22`.
</issue_to_address>Sourcery assessment
Approval pending. 3 findings to address first.
Blocking findings: test/ui_text_literals_translated_test.dart:47, lib/l10n/display_text.dart:132, test/ui_text_literals_translated_test.dart:21
It belongs to OpenStrap#725. This PR only carries the ChatGPT sign-in and alarm fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Housekeeping: #725's commit landed on this branch by mistake. It's reverted here rather than force-pushed, so the net diff is only the ChatGPT sign-in and alarm fix (squash-merge recommended). |
…calizations.of(c) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
The coach's ChatGPT sign-in flow (#602) passes its copy through
uiText, but none of the 21 strings has an entry inlocalizedText, so the whole flow shows English in every language. That includes the data-sharing notice (questions and rows go to OpenAI under the user's ChatGPT account, where model-training controls may apply) and the "Before you sign in" step that links OpenAI's Terms of Use and Usage Policies. Those are the two texts a user most needs to understand in their own language before continuing. The same applies to "Cancel" there, and to one alarm status line from ef38869 ("Saved, but the band hasn't taken it yet…").coachChatgpt*,alarmSavedNotOnBand), in English and all seven languages, inserted beforeactionCancelso they don't collide with l10n(es): translate the supplement catalogue, so 300 strings stop falling back to English #720–l10n(hi): translate the supplement catalogue, so 300 strings stop falling back to English #723 (end of file) or l10n: translate the current HRV, HRV-stability and breathing-rate method text, which every language showed in English since Oct 2 #725 (beforemetricDetailSlotWithValue).localizedTextmaps each English string to its key, and "Cancel" maps to the existingactionCancel. The call sites don't change.aiBriefingSentSection), and ChatGPT, OpenAI and OpenStrap stay as names.New guard
test/ui_text_literals_translated_test.dart: it reads every literal passed touiText,localizedTextorpresentationTextunderlib/. Each one must translate in at least one of de/ru/th, the complete catalogues, so a word that is legitimately the same in one of them still passes. Onmainit lists exactly these 23 call sites.Testing
main(23 call sites) and passes with the change.copy_jargon_guard_testand the screen sweep.app_state_pairing_confirmation_testfailed once in a large parallel run and passes alone, on this branch and onmain. It's unrelated.flutter gen-l10nandflutter analyzeare clean.I'm not a native speaker. The data-sharing and terms texts are the ones most worth a native read.
Risks and rollback
Copy and lookup only. Revert the commit to roll back.
Checklist
🤖 Generated with Claude Code
Summary by Sourcery
Translate previously untranslated ChatGPT sign-in and alarm status text across all supported languages and prevent similar omissions.
Bug Fixes:
Enhancements:
Tests:
Summary by CodeRabbit