Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/l10n/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@
"roughNightAddHowMuch": "Menge angeben",
"roughNightDoNotAskAgain": "Nicht erneut fragen",
"roughNightSeveralMoved": "Mehrere nächtliche Werte haben sich gleichzeitig verändert",
"roughNightJoinLast": "{rest} und {last}",
"driverBreakdownHigherThanUsual": "Höher als sonst",
"driverBreakdownLowerThanUsual": "Niedriger als sonst",
"driverBreakdownRightOnUsual": "{now} · genau wie sonst",
Expand Down
12 changes: 12 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -2770,6 +2770,18 @@
"@roughNightSeveralMoved": {
"description": "Fallback clause when the Rough Night card has no named moved measurements."
},
"roughNightJoinLast": "{rest} and {last}",
"@roughNightJoinLast": {
"description": "Rough Night: joins the last moved-measurement clause onto the rest, as in 'a, b and c'. {rest} is the earlier clauses already joined with commas.",
"placeholders": {
"rest": {
"type": "String"
},
"last": {
"type": "String"
}
}
},
"driverBreakdownHigherThanUsual": "Higher than your usual",
"@driverBreakdownHigherThanUsual": {
"description": "Driver breakdown: non-numeric input (e.g. skin temp) moved up vs usual."
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@
"roughNightAddHowMuch": "Añadir cuánto",
"roughNightDoNotAskAgain": "No volver a preguntar",
"roughNightSeveralMoved": "Varias mediciones nocturnas se movieron juntas",
"roughNightJoinLast": "{rest} y {last}",
"driverBreakdownHigherThanUsual": "Más alto que lo habitual",
"driverBreakdownLowerThanUsual": "Más bajo que lo habitual",
"driverBreakdownRightOnUsual": "{now} · justo en tu habitual",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@
"roughNightAddHowMuch": "Ajouter la quantité",
"roughNightDoNotAskAgain": "Ne plus demander",
"roughNightSeveralMoved": "Plusieurs mesures nocturnes ont évolué ensemble",
"roughNightJoinLast": "{rest} et {last}",
"driverBreakdownHigherThanUsual": "Plus élevé que d’habitude",
"driverBreakdownLowerThanUsual": "Plus bas que d’habitude",
"driverBreakdownRightOnUsual": "{now} · exactement comme d’habitude",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_hi.arb
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@
"roughNightAddHowMuch": "मात्रा जोड़ें",
"roughNightDoNotAskAgain": "दोबारा न पूछें",
"roughNightSeveralMoved": "रात के कई माप एक साथ बदले",
"roughNightJoinLast": "{rest} और {last}",
"driverBreakdownHigherThanUsual": "आपके सामान्य से अधिक",
"driverBreakdownLowerThanUsual": "आपके सामान्य से कम",
"driverBreakdownRightOnUsual": "{now} · आपके सामान्य के बिल्कुल अनुरूप",
Expand Down
11 changes: 11 additions & 0 deletions lib/l10n/app_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,17 @@
"roughNightAddHowMuch": "Указать количество",
"roughNightDoNotAskAgain": "Больше не спрашивать",
"roughNightSeveralMoved": "Несколько ночных показателей изменились одновременно",
"roughNightJoinLast": "{rest} и {last}",
"@roughNightJoinLast": {
"placeholders": {
"rest": {
"type": "String"
},
"last": {
"type": "String"
}
}
},
"driverBreakdownHigherThanUsual": "Выше обычного для вас",
"driverBreakdownLowerThanUsual": "Ниже обычного для вас",
"driverBreakdownRightOnUsual": "{now} · на вашем обычном уровне",
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_th.arb
Original file line number Diff line number Diff line change
Expand Up @@ -2494,6 +2494,7 @@
"@roughNightSeveralMoved": {
"description": "Fallback clause when the Rough Night card has no named moved measurements."
},
"roughNightJoinLast": "{rest} และ{last}",
"driverBreakdownHigherThanUsual": "สูงกว่าปกติของคุณ",
"@driverBreakdownHigherThanUsual": {
"description": "Driver breakdown: non-numeric input (e.g. skin temp) moved up vs usual."
Expand Down
1 change: 1 addition & 0 deletions lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@
"roughNightAddHowMuch": "添加具体数量",
"roughNightDoNotAskAgain": "不再询问",
"roughNightSeveralMoved": "多项夜间指标同时发生了变化",
"roughNightJoinLast": "{rest},并且{last}",
"driverBreakdownHigherThanUsual": "高于你的通常水平",
"driverBreakdownLowerThanUsual": "低于你的通常水平",
"driverBreakdownRightOnUsual": "{now} · 正好处于你的通常水平",
Expand Down
3 changes: 2 additions & 1 deletion lib/ui2/screens/rough_night.dart
Original file line number Diff line number Diff line change
Expand Up @@ -624,9 +624,10 @@ class _RoughNightCardState extends State<RoughNightCard> {
return l?.roughNightSeveralMoved ??
'Several overnight measurements moved together';
}
final rest = parts.sublist(0, parts.length - 1).join(', ');
final s = parts.length == 1
? parts.first
: '${parts.sublist(0, parts.length - 1).join(', ')} and ${parts.last}';
: l?.roughNightJoinLast(rest, parts.last) ?? '$rest and ${parts.last}';
return s[0].toUpperCase() + s.substring(1);
}
}
27 changes: 27 additions & 0 deletions test/rough_night_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:openstrap_edge/l10n/app_localizations.dart';
import 'package:openstrap_edge/ui2/grammar.dart';
import 'package:openstrap_edge/ui2/screens/rough_night.dart';
import 'package:openstrap_edge/ui2/theme.dart';
Expand Down Expand Up @@ -239,6 +240,32 @@ void main() {
expect(find.text('Tell it what happened'), findsNothing);
});

testWidgets('joins the moved signs in the reader\'s language', (t) async {
await t.pumpWidget(MaterialApp(
locale: const Locale('de'),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
theme: buildTheme(Brightness.light),
home: const Scaffold(
body: SingleChildScrollView(
child: RoughNightCard(
night: RoughNight(
day: '2026-08-15',
signs: 3,
descriptor: 'x',
moved: ['a', 'b', 'c'],
knows: [],
),
ask: 'never',
),
),
),
));
await t.pumpAndSettle();
expect(find.textContaining('A, b und c'), findsOneWidget);
expect(find.textContaining(' and '), findsNothing);
});

// The gallery sweeps cover this too, once every case in it compiles. This
// one is here because the card's own longest state — four moved
// measurements, four knowns, thirteen chips — is the thing worth pinning to
Expand Down
Loading