Skip to content

Commit f2e0ad7

Browse files
committed
feat(notifications): localization
1 parent b8912dc commit f2e0ad7

28 files changed

+801
-11
lines changed

lib/Screens/Settings/notifications.dart

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
import 'package:awesome_notifications/awesome_notifications.dart';
21+
import 'package:boxbox/l10n/app_localizations.dart';
2122
import 'package:flutter/material.dart';
2223
import 'package:hive_flutter/hive_flutter.dart';
2324
import 'package:workmanager/workmanager.dart';
@@ -43,22 +44,22 @@ class _NotificationsSettingsScreenState
4344
int refreshInterval =
4445
Hive.box('settings').get('refreshInterval', defaultValue: 6) as int;
4546
Map durations = {
46-
2: '2 hours',
47-
6: '6 hours',
48-
12: '12 hours',
49-
24: '24 hours',
47+
2: AppLocalizations.of(context)!.notifications2hours,
48+
6: AppLocalizations.of(context)!.notifications6hours,
49+
12: AppLocalizations.of(context)!.notifications12hours,
50+
24: AppLocalizations.of(context)!.notifications24hours,
5051
};
5152

5253
return Scaffold(
5354
appBar: AppBar(
54-
title: Text('Notifications'),
55+
title: Text(AppLocalizations.of(context)!.notifications),
5556
backgroundColor: Theme.of(context).colorScheme.onPrimary,
5657
),
5758
body: Column(
5859
children: [
5960
SwitchListTile(
6061
title: Text(
61-
'Enable notifications',
62+
AppLocalizations.of(context)!.enableNotifications,
6263
),
6364
value: notificationsEnabled,
6465
onChanged: (bool value) async {
@@ -87,7 +88,7 @@ class _NotificationsSettingsScreenState
8788
),
8889
SwitchListTile(
8990
title: Text(
90-
'Articles notifications',
91+
AppLocalizations.of(context)!.articleNotifications,
9192
),
9293
value: newsNotificationsEnabled,
9394
onChanged: notificationsEnabled
@@ -115,7 +116,7 @@ class _NotificationsSettingsScreenState
115116
),
116117
ListTile(
117118
title: Text(
118-
'Refresh interval',
119+
AppLocalizations.of(context)!.refreshInterval,
119120
style: TextStyle(),
120121
),
121122
enabled: notificationsEnabled && newsNotificationsEnabled,
@@ -157,10 +158,10 @@ class _NotificationsSettingsScreenState
157158
),
158159
SwitchListTile(
159160
title: Text(
160-
'Sessions notifications',
161+
AppLocalizations.of(context)!.grandPrixNotifications,
161162
),
162163
subtitle: Text(
163-
'You need to go to the schedule screen in order to initialize notifications for the next Grand-Prix.',
164+
AppLocalizations.of(context)!.grandPrixNotificationsSub,
164165
),
165166
value: sessionNotificationsEnabled,
166167
onChanged: notificationsEnabled

lib/Screens/Settings/settings.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
6060
onTap: () => context.pushNamed('player-settings'),
6161
),
6262
ListTile(
63-
title: Text('Notifications'),
63+
title: Text(AppLocalizations.of(context)!.notifications),
6464
leading: Icon(Icons.notifications_outlined),
6565
onTap: () => context.pushNamed('notifications-settings'),
6666
),

lib/l10n/app_en.arb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
"@apply": {},
2424
"articleFull": "Full",
2525
"@articleFull": {},
26+
"articleNotifications": "New articles notifications",
27+
"@articleNotifications": {},
2628
"articleTitleAndImage": "Title and Image",
2729
"@articleTitleAndImage": {},
2830
"articleTitleAndDescription": "Title and Description",
@@ -103,6 +105,8 @@
103105
"@edit": {},
104106
"editOrderDescription": "Change order by long-pressing an item.",
105107
"@editOrderDescription": {},
108+
"enableNotifications": "Enable notifications",
109+
"@enableNotifications": {},
106110
"errorOccurred": "Something went wrong",
107111
"@errorOccurred": {},
108112
"errorOccurredDetails": "The app encountered an unknown error.\nPlease try again later.",
@@ -151,6 +155,10 @@
151155
"@grandsPrix": {},
152156
"grandPrixMap": "Grand Prix Map",
153157
"@grandPrixMap": {},
158+
"grandPrixNotifications": "Grand-Prix sessions notifications",
159+
"@grandPrixNotifications": {},
160+
"grandPrixNotificationsSub": "You need to go to the schedule screen in order to initialize notifications of the next Grand-Prix.",
161+
"@grandPrixNotificationsSub": {},
154162
"hallOfFame": "Hall of Fame",
155163
"@hallOfFame": {},
156164
"highestRaceFinish": "Highest race finish",
@@ -225,6 +233,16 @@
225233
"@noResults": {},
226234
"nothingHere": "Nothing to show\nhere.",
227235
"@nothingHere": {},
236+
"notifications": "Notifications",
237+
"@notifications": {},
238+
"notifications2hours": "2 hours",
239+
"@notifications2hours": {},
240+
"notifications6hours": "6 hours",
241+
"@notifications6hours": {},
242+
"notifications12hours": "12 hours",
243+
"@notifications12hours": {},
244+
"notifications24hours": "24 hours",
245+
"@notifications24hours": {},
228246
"numberOfLaps": "Number of Laps",
229247
"@numberOfLaps": {},
230248
"official": "Official",
@@ -297,6 +315,8 @@
297315
"@refreshChampionshipData": {},
298316
"refreshChampionshipDataSub": "Refresh championship data before a new season.",
299317
"@refreshChampionshipDataSub": {},
318+
"refreshInterval": "Refresh interval",
319+
"@refreshInterval": {},
300320
"requestError": "Could not fetch data.",
301321
"@requestError": {},
302322
"results": "Results",

lib/l10n/app_fr.arb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
"@apply": {},
2424
"articleFull": "Complet",
2525
"@articleFull": {},
26+
"articleNotifications": "Notifications pour les nouveaux articles",
27+
"@articleNotifications": {},
2628
"articleTitleAndImage": "Titre et Image",
2729
"@articleTitleAndImage": {},
2830
"articleTitleAndDescription": "Titre et Description",
@@ -103,6 +105,8 @@
103105
"@edit": {},
104106
"editOrderDescription": "Changez l'ordre en appuyant longtemps sur un élément.",
105107
"@editOrderDescription": {},
108+
"enableNotifications": "Activer les notifications",
109+
"@enableNotifications": {},
106110
"errorOccurred": "Une erreur est survenue",
107111
"@errorOccurred": {},
108112
"errorOccurredDetails": "L'application a rencontré une erreur inconnue.\nVeuillez réessayer plus tard.",
@@ -151,6 +155,10 @@
151155
"@grandsPrix": {},
152156
"grandPrixMap": "Carte du Grand-Prix",
153157
"@grandPrixMap": {},
158+
"grandPrixNotifications": "Notifications des sessions des Grand-Prix",
159+
"@grandPrixNotifications": {},
160+
"grandPrixNotificationsSub": "Vous devez vous rendre sur le calendrier afin d'initialiser les notifications du prochain Grand-Prix.",
161+
"@grandPrixNotificationsSub": {},
154162
"hallOfFame": "Panthéon",
155163
"@hallOfFame": {},
156164
"highestRaceFinish": "Meilleur résultat (course)",
@@ -225,6 +233,15 @@
225233
"@noResults": {},
226234
"nothingHere": "Rien à afficher\nici.",
227235
"@nothingHere": {},
236+
"notifications": "Notifications",
237+
"@notifications": {},
238+
"notifications2hours": "2 heures",
239+
"@notifications2hours": {},
240+
"notifications6hours": "6 heures",
241+
"@notifications6hours": {},
242+
"notifications12hours": "12 heures",
243+
"@notifications12hours": {},
244+
"notifications24hours": "24 heures",
228245
"numberOfLaps": "Nombre de tours",
229246
"@numberOfLaps": {},
230247
"official": "Officiel",
@@ -299,6 +316,8 @@
299316
"@refreshChampionshipData": {},
300317
"refreshChampionshipDataSub": "Rafraîchissez les données du championnat une fois avant une nouvelle saison.",
301318
"@refreshChampionshipDataSub": {},
319+
"refreshInterval": "Intervalle de rafraîchissement",
320+
"@refreshInterval": {},
302321
"requestError": "Impossible de récupérer les données.",
303322
"@requestError": {},
304323
"results": "Résultats",

lib/l10n/app_localizations.dart

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,12 @@ abstract class AppLocalizations {
209209
/// **'Full'**
210210
String get articleFull;
211211

212+
/// No description provided for @articleNotifications.
213+
///
214+
/// In en, this message translates to:
215+
/// **'New articles notifications'**
216+
String get articleNotifications;
217+
212218
/// No description provided for @articleTitleAndImage.
213219
///
214220
/// In en, this message translates to:
@@ -449,6 +455,12 @@ abstract class AppLocalizations {
449455
/// **'Change order by long-pressing an item.'**
450456
String get editOrderDescription;
451457

458+
/// No description provided for @enableNotifications.
459+
///
460+
/// In en, this message translates to:
461+
/// **'Enable notifications'**
462+
String get enableNotifications;
463+
452464
/// No description provided for @errorOccurred.
453465
///
454466
/// In en, this message translates to:
@@ -587,6 +599,18 @@ abstract class AppLocalizations {
587599
/// **'Grand Prix Map'**
588600
String get grandPrixMap;
589601

602+
/// No description provided for @grandPrixNotifications.
603+
///
604+
/// In en, this message translates to:
605+
/// **'Grand-Prix sessions notifications'**
606+
String get grandPrixNotifications;
607+
608+
/// No description provided for @grandPrixNotificationsSub.
609+
///
610+
/// In en, this message translates to:
611+
/// **'You need to go to the schedule screen in order to initialize notifications of the next Grand-Prix.'**
612+
String get grandPrixNotificationsSub;
613+
590614
/// No description provided for @hallOfFame.
591615
///
592616
/// In en, this message translates to:
@@ -809,6 +833,36 @@ abstract class AppLocalizations {
809833
/// **'Nothing to show\nhere.'**
810834
String get nothingHere;
811835

836+
/// No description provided for @notifications.
837+
///
838+
/// In en, this message translates to:
839+
/// **'Notifications'**
840+
String get notifications;
841+
842+
/// No description provided for @notifications2hours.
843+
///
844+
/// In en, this message translates to:
845+
/// **'2 hours'**
846+
String get notifications2hours;
847+
848+
/// No description provided for @notifications6hours.
849+
///
850+
/// In en, this message translates to:
851+
/// **'6 hours'**
852+
String get notifications6hours;
853+
854+
/// No description provided for @notifications12hours.
855+
///
856+
/// In en, this message translates to:
857+
/// **'12 hours'**
858+
String get notifications12hours;
859+
860+
/// No description provided for @notifications24hours.
861+
///
862+
/// In en, this message translates to:
863+
/// **'24 hours'**
864+
String get notifications24hours;
865+
812866
/// No description provided for @numberOfLaps.
813867
///
814868
/// In en, this message translates to:
@@ -1025,6 +1079,12 @@ abstract class AppLocalizations {
10251079
/// **'Refresh championship data before a new season.'**
10261080
String get refreshChampionshipDataSub;
10271081

1082+
/// No description provided for @refreshInterval.
1083+
///
1084+
/// In en, this message translates to:
1085+
/// **'Refresh interval'**
1086+
String get refreshInterval;
1087+
10281088
/// No description provided for @requestError.
10291089
///
10301090
/// In en, this message translates to:

lib/l10n/app_localizations_ar.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ class AppLocalizationsAr extends AppLocalizations {
4444
@override
4545
String get articleFull => 'ممتلىء';
4646

47+
@override
48+
String get articleNotifications => 'New articles notifications';
49+
4750
@override
4851
String get articleTitleAndImage => 'العنوان والصورة';
4952

@@ -164,6 +167,9 @@ class AppLocalizationsAr extends AppLocalizations {
164167
@override
165168
String get editOrderDescription => 'قم بتغيير الترتيب بالضغط لفترة طويلة على أحد البنود.';
166169

170+
@override
171+
String get enableNotifications => 'Enable notifications';
172+
167173
@override
168174
String get errorOccurred => 'حدث خطأ ما';
169175

@@ -233,6 +239,12 @@ class AppLocalizationsAr extends AppLocalizations {
233239
@override
234240
String get grandPrixMap => 'خريطة الجائزة الكبرى';
235241

242+
@override
243+
String get grandPrixNotifications => 'Grand-Prix sessions notifications';
244+
245+
@override
246+
String get grandPrixNotificationsSub => 'You need to go to the schedule screen in order to initialize notifications of the next Grand-Prix.';
247+
236248
@override
237249
String get hallOfFame => 'قاعة الشهرة';
238250

@@ -344,6 +356,21 @@ class AppLocalizationsAr extends AppLocalizations {
344356
@override
345357
String get nothingHere => 'لا شيء لإظهاره\nهنا.';
346358

359+
@override
360+
String get notifications => 'Notifications';
361+
362+
@override
363+
String get notifications2hours => '2 hours';
364+
365+
@override
366+
String get notifications6hours => '6 hours';
367+
368+
@override
369+
String get notifications12hours => '12 hours';
370+
371+
@override
372+
String get notifications24hours => '24 hours';
373+
347374
@override
348375
String get numberOfLaps => 'عدد اللفات';
349376

@@ -452,6 +479,9 @@ class AppLocalizationsAr extends AppLocalizations {
452479
@override
453480
String get refreshChampionshipDataSub => 'Refresh championship data before a new season.';
454481

482+
@override
483+
String get refreshInterval => 'Refresh interval';
484+
455485
@override
456486
String get requestError => 'تعذر جلب البيانات.';
457487

0 commit comments

Comments
 (0)