Repository navigation
Health Trends and Investigate: metric names mid-sentence via nounInSentence #689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kurexw
wants to merge
1
commit into
OpenStrap:main
Choose a base branch
from
kurexw:fix/metric-name-case-in-sentences
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+84
−3
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // Investigate's "nothing stored yet" line put the metric name through a bare | ||
| // toLowerCase(), so English read "Nothing stored for rem sleep yet." and German | ||
| // "Für ruhepuls ist noch nichts gespeichert." It now goes through | ||
| // nounInSentence, the same rule the Health rows and the metric detail use. | ||
|
|
||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:openstrap_edge/data/day_label.dart'; | ||
| import 'package:openstrap_edge/l10n/app_localizations.dart'; | ||
| import 'package:openstrap_edge/ui2/screens/screens.dart'; | ||
| import 'package:openstrap_edge/ui2/ui2.dart'; | ||
|
|
||
| Future<void> _pump(WidgetTester t, String key, {Locale? locale}) async { | ||
| t.view.physicalSize = const Size(390 * 3, 3000 * 3); | ||
| t.view.devicePixelRatio = 3; | ||
| addTearDown(t.view.reset); | ||
| await t.pumpWidget(MaterialApp( | ||
| theme: buildTheme(Brightness.light), | ||
| locale: locale, | ||
| localizationsDelegates: AppLocalizations.localizationsDelegates, | ||
| supportedLocales: AppLocalizations.supportedLocales, | ||
| home: Investigate(key, | ||
| data: InvestigateData(day: todayLabel(), series: const [])), | ||
| )); | ||
| await t.pumpAndSettle(); | ||
| } | ||
|
|
||
| void main() { | ||
| testWidgets('english lowercases a name but keeps an acronym', (t) async { | ||
| await _pump(t, 'resting_hr', locale: const Locale('en')); | ||
| expect(find.text('Nothing stored for resting heart rate yet.'), | ||
| findsOneWidget); | ||
|
|
||
| await _pump(t, 'rem', locale: const Locale('en')); | ||
| expect(find.text('Nothing stored for REM sleep yet.'), findsOneWidget); | ||
| expect(find.text('Nothing stored for rem sleep yet.'), findsNothing); | ||
| }); | ||
|
|
||
| testWidgets('german keeps the noun case', (t) async { | ||
| await _pump(t, 'resting_hr', locale: const Locale('de')); | ||
| expect(find.text('Für Ruhepuls ist noch nichts gespeichert.'), | ||
| findsOneWidget); | ||
| expect(find.text('Für ruhepuls ist noch nichts gespeichert.'), | ||
| findsNothing); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle German adjective-led titles.
For
calories, this passesAktive Energieunchanged into the German template, producing “Für Aktive Energie ist noch nichts gespeichert.” The adjective should not be capitalized mid-sentence. Thediptitle has the same problem. (raw.githubusercontent.com)Quote the metric title in the German template or provide a correctly inflected phrase. Add a test for an adjective-led title.