Skip to content

Commit 042f0a0

Browse files
Add localization
1 parent cc601bf commit 042f0a0

File tree

7 files changed

+222
-21
lines changed

7 files changed

+222
-21
lines changed

.idea/caches/deviceStreaming.xml

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/lib/l10n/app_en.arb

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
},
2626

2727
"delete": "Delete",
28+
"deleteAnyways": "Delete anyways",
2829
"clear": "Clear",
2930
"save": "Save",
3031
"import": "Import",
@@ -170,6 +171,31 @@
170171
"settingsScreen_notificationTime": "Notification Time",
171172
"settingsScreen_overduePeriodReminder": "Overdue Period Reminder",
172173
"settingsScreen_remindMeAfter": "Remind Me After",
174+
"settingsScreen_defaultSymptoms": "Default Symptoms",
175+
"settingsScreen_defaultSymptomsSubtitle": "These are always available when logging new periods.\nTap an existing symptom to delete or '+' to add a new one.",
176+
"settingsScreen_deleteDefaultSymptomQuestion": "Delete '{symptom}'?",
177+
"@settingsScreen_deleteDefaultSymptomQuestion": {
178+
"description": "Question whether a symptom should be deleted.",
179+
"placeholders": {
180+
"symptom": {
181+
"type": "String",
182+
"example": "The name of the symptom."
183+
}
184+
}
185+
},
186+
"settingsScreen_deleteDefaultSymptomDescription": "'{symptom}' will no longer be available when logging a period.\n\n{usageCount, plural, zero{There are currently no period logs with this symptom!} one{There is already 1 period log with this symptom!\nThis log will not be changed.} other{There are {usageCount} period logs with this symptom!\nThese logs will not be changed.}}",
187+
"@settingsScreen_deleteDefaultSymptomDescription": {
188+
"description": "Question whether a symptom should be deleted.",
189+
"placeholders": {
190+
"symptom": {
191+
"type": "String",
192+
"example": "The name of the symptom."
193+
},
194+
"usageCount" : {
195+
196+
}
197+
}
198+
},
173199
"settingsScreen_pillRegimens": "Pill Regimens",
174200
"@settingsScreen_pillRegimens": {
175201
"description": "Header for the section listing all created pill regimens."
@@ -330,6 +356,9 @@
330356
"type": "int"
331357
}
332358
}
333-
}
334-
359+
},
360+
"customSymptomDialog_newCustomSymptom": "New custom symptom",
361+
"customSymptomDialog_enterCustomSymptom": "Please enter a custom symptom",
362+
"customSymptomDialog_makeDefault": "Make default symptom"
363+
335364
}

app/lib/l10n/app_localizations.dart

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ abstract class AppLocalizations {
158158
/// **'Delete'**
159159
String get delete;
160160

161+
/// No description provided for @deleteAnyways.
162+
///
163+
/// In en, this message translates to:
164+
/// **'Delete anyways'**
165+
String get deleteAnyways;
166+
161167
/// No description provided for @clear.
162168
///
163169
/// In en, this message translates to:
@@ -686,6 +692,33 @@ abstract class AppLocalizations {
686692
/// **'Remind Me After'**
687693
String get settingsScreen_remindMeAfter;
688694

695+
/// No description provided for @settingsScreen_defaultSymptoms.
696+
///
697+
/// In en, this message translates to:
698+
/// **'Default Symptoms'**
699+
String get settingsScreen_defaultSymptoms;
700+
701+
/// No description provided for @settingsScreen_defaultSymptomsSubtitle.
702+
///
703+
/// In en, this message translates to:
704+
/// **'These are always available when logging new periods.\nTap an existing symptom to delete or \'+\' to add a new one.'**
705+
String get settingsScreen_defaultSymptomsSubtitle;
706+
707+
/// Question whether a symptom should be deleted.
708+
///
709+
/// In en, this message translates to:
710+
/// **'Delete \'{symptom}\'?'**
711+
String settingsScreen_deleteDefaultSymptomQuestion(String symptom);
712+
713+
/// Question whether a symptom should be deleted.
714+
///
715+
/// In en, this message translates to:
716+
/// **'\'{symptom}\' will no longer be available when logging a period.\n\n{usageCount, plural, zero{There are currently no period logs with this symptom!} one{There is already 1 period log with this symptom!\nThis log will not be changed.} other{There are {usageCount} period logs with this symptom!\nThese logs will not be changed.}}'**
717+
String settingsScreen_deleteDefaultSymptomDescription(
718+
String symptom,
719+
num usageCount,
720+
);
721+
689722
/// Header for the section listing all created pill regimens.
690723
///
691724
/// In en, this message translates to:
@@ -1231,6 +1264,24 @@ abstract class AppLocalizations {
12311264
/// In en, this message translates to:
12321265
/// **'{count, plural, =1{Day} other{Days}}'**
12331266
String periodPredictionCircle_days(int count);
1267+
1268+
/// No description provided for @customSymptomDialog_newCustomSymptom.
1269+
///
1270+
/// In en, this message translates to:
1271+
/// **'New custom symptom'**
1272+
String get customSymptomDialog_newCustomSymptom;
1273+
1274+
/// No description provided for @customSymptomDialog_enterCustomSymptom.
1275+
///
1276+
/// In en, this message translates to:
1277+
/// **'Please enter a custom symptom'**
1278+
String get customSymptomDialog_enterCustomSymptom;
1279+
1280+
/// No description provided for @customSymptomDialog_makeDefault.
1281+
///
1282+
/// In en, this message translates to:
1283+
/// **'Make default symptom'**
1284+
String get customSymptomDialog_makeDefault;
12341285
}
12351286

12361287
class _AppLocalizationsDelegate

app/lib/l10n/app_localizations_de.dart

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class AppLocalizationsDe extends AppLocalizations {
4646
@override
4747
String get delete => 'Löschen';
4848

49+
@override
50+
String get deleteAnyways => 'Delete anyways';
51+
4952
@override
5053
String get clear => 'Clear';
5154

@@ -347,6 +350,35 @@ class AppLocalizationsDe extends AppLocalizations {
347350
@override
348351
String get settingsScreen_remindMeAfter => 'Remind Me After';
349352

353+
@override
354+
String get settingsScreen_defaultSymptoms => 'Default Symptoms';
355+
356+
@override
357+
String get settingsScreen_defaultSymptomsSubtitle =>
358+
'These are always available when logging new periods.\nTap an existing symptom to delete or \'+\' to add a new one.';
359+
360+
@override
361+
String settingsScreen_deleteDefaultSymptomQuestion(String symptom) {
362+
return 'Delete \'$symptom\'?';
363+
}
364+
365+
@override
366+
String settingsScreen_deleteDefaultSymptomDescription(
367+
String symptom,
368+
num usageCount,
369+
) {
370+
String _temp0 = intl.Intl.pluralLogic(
371+
usageCount,
372+
locale: localeName,
373+
other:
374+
'There are $usageCount period logs with this symptom!\nThese logs will not be changed.',
375+
one:
376+
'There is already 1 period log with this symptom!\nThis log will not be changed.',
377+
zero: 'There are currently no period logs with this symptom!',
378+
);
379+
return '\'$symptom\' will no longer be available when logging a period.\n\n$_temp0';
380+
}
381+
350382
@override
351383
String get settingsScreen_pillRegimens => 'Pill Regimens';
352384

@@ -673,4 +705,14 @@ class AppLocalizationsDe extends AppLocalizations {
673705
);
674706
return '$_temp0';
675707
}
708+
709+
@override
710+
String get customSymptomDialog_newCustomSymptom => 'New custom symptom';
711+
712+
@override
713+
String get customSymptomDialog_enterCustomSymptom =>
714+
'Please enter a custom symptom';
715+
716+
@override
717+
String get customSymptomDialog_makeDefault => 'Make default symptom';
676718
}

app/lib/l10n/app_localizations_en.dart

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class AppLocalizationsEn extends AppLocalizations {
4646
@override
4747
String get delete => 'Delete';
4848

49+
@override
50+
String get deleteAnyways => 'Delete anyways';
51+
4952
@override
5053
String get clear => 'Clear';
5154

@@ -345,6 +348,35 @@ class AppLocalizationsEn extends AppLocalizations {
345348
@override
346349
String get settingsScreen_remindMeAfter => 'Remind Me After';
347350

351+
@override
352+
String get settingsScreen_defaultSymptoms => 'Default Symptoms';
353+
354+
@override
355+
String get settingsScreen_defaultSymptomsSubtitle =>
356+
'These are always available when logging new periods.\nTap an existing symptom to delete or \'+\' to add a new one.';
357+
358+
@override
359+
String settingsScreen_deleteDefaultSymptomQuestion(String symptom) {
360+
return 'Delete \'$symptom\'?';
361+
}
362+
363+
@override
364+
String settingsScreen_deleteDefaultSymptomDescription(
365+
String symptom,
366+
num usageCount,
367+
) {
368+
String _temp0 = intl.Intl.pluralLogic(
369+
usageCount,
370+
locale: localeName,
371+
other:
372+
'There are $usageCount period logs with this symptom!\nThese logs will not be changed.',
373+
one:
374+
'There is already 1 period log with this symptom!\nThis log will not be changed.',
375+
zero: 'There are currently no period logs with this symptom!',
376+
);
377+
return '\'$symptom\' will no longer be available when logging a period.\n\n$_temp0';
378+
}
379+
348380
@override
349381
String get settingsScreen_pillRegimens => 'Pill Regimens';
350382

@@ -671,4 +703,14 @@ class AppLocalizationsEn extends AppLocalizations {
671703
);
672704
return '$_temp0';
673705
}
706+
707+
@override
708+
String get customSymptomDialog_newCustomSymptom => 'New custom symptom';
709+
710+
@override
711+
String get customSymptomDialog_enterCustomSymptom =>
712+
'Please enter a custom symptom';
713+
714+
@override
715+
String get customSymptomDialog_makeDefault => 'Make default symptom';
674716
}

app/lib/screens/settings/period_settings_screen.dart

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,25 +106,14 @@ class _PeriodSettingsScreenState extends State<PeriodSettingsScreen> {
106106
final l10n = AppLocalizations.of(context)!;
107107
final symptomUsageCount = await periodsRepo.getSymptomUseCount(symptom);
108108

109-
var description = "'$symptom' will no longer be available when logging a period.\n\n";
110-
111-
if (symptomUsageCount == 0) {
112-
description += "There are currently no period logs with this symptom!";
113-
}
114-
else if (symptomUsageCount == 1) {
115-
description += "There is already $symptomUsageCount period log with this symptom!\nThis log will not be changed.";
116-
} else if (symptomUsageCount > 1) {
117-
description += "There are $symptomUsageCount period logs with this symptom!\nThese logs will not be changed.";
118-
}
119-
120109
if (mounted) {
121110
return showDialog<void>(
122111
context: context,
123112
builder: (BuildContext context) {
124113
return ConfirmationDialog(
125-
title: "Delete '$symptom'?",
126-
contentText: description,
127-
confirmButtonText: symptomUsageCount > 0 ? "Delete anyways" : l10n.delete,
114+
title: l10n.settingsScreen_deleteDefaultSymptomQuestion(symptom),
115+
contentText: l10n.settingsScreen_deleteDefaultSymptomDescription(symptom, symptomUsageCount),
116+
confirmButtonText: symptomUsageCount > 0 ? l10n.deleteAnyways : l10n.delete,
128117
onConfirm: () async {
129118
setState(() {
130119
_defaultSymptoms.remove(symptom);
@@ -149,10 +138,10 @@ class _PeriodSettingsScreenState extends State<PeriodSettingsScreen> {
149138
: ListView(
150139
children: [
151140
ListTile(
152-
title: Text("Default symptoms"),
141+
title: Text(l10n.settingsScreen_defaultSymptoms),
153142
leading: Icon(Icons.bubble_chart_outlined, color: colorScheme.onSurfaceVariant, size: 20),
154143
),
155-
ListTile(subtitle: Text("These are always available when logging new periods.\nTap an existing symptom to delete or '+' to add a new one.")),
144+
ListTile(subtitle: Text(l10n.settingsScreen_defaultSymptomsSubtitle)),
156145
Padding(
157146
padding: EdgeInsets.symmetric(horizontal: 12),
158147
child: Wrap(

app/lib/widgets/dialogs/custom_symptom_dialog.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ class _CustomSymptomDialogState extends State<CustomSymptomDialog> {
2727
final l10n = AppLocalizations.of(context)!;
2828

2929
return AlertDialog.adaptive(
30-
title: Text("New custom symptom", textAlign: TextAlign.center),
30+
title: Text(l10n.customSymptomDialog_newCustomSymptom, textAlign: TextAlign.center),
3131
content: SizedBox(
3232
width: double.maxFinite,
3333
child: Form(
3434
key: _formKey,
3535
child: ListView(
3636
shrinkWrap: true,
3737
children: [
38-
TextFormField(controller: _nameController, validator: (value) => value!.isEmpty ? "Please enter a custom symptom" : null, autofocus: true, maxLength: 60, maxLines: 1),
38+
TextFormField(controller: _nameController, validator: (value) => value!.isEmpty ? l10n.customSymptomDialog_enterCustomSymptom : null, autofocus: true, maxLength: 60, maxLines: 1),
3939
if (widget.showMakeDefaultButton) const SizedBox(height: 16),
4040
if (widget.showMakeDefaultButton)
4141
SwitchListTile(
42-
subtitle: Text("Make default symptom"),
42+
subtitle: Text(l10n.customSymptomDialog_makeDefault),
4343
secondary: const Icon(Icons.fact_check),
4444
value: _isDefault,
4545
onChanged: (value) => {

0 commit comments

Comments
 (0)