Skip to content

Commit 1fb8fab

Browse files
committed
Add localization for match details page text and dialog messages
1 parent b74fc3a commit 1fb8fab

5 files changed

Lines changed: 143 additions & 36 deletions

File tree

lib/l10n/arb/app_en.arb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,5 +582,20 @@
582582
"type": "text",
583583
"placeholders": {}
584584
}
585-
585+
,
586+
"achievementColumnHeader": "Achievement",
587+
"youTooltip": "You",
588+
"wentFirstTooltip": "Went First",
589+
"deleteMatchDialogTitle": "Delete Match",
590+
"deleteMatchDialogContent": "Are you sure you want to delete this match?",
591+
"cancelButtonLabel": "Cancel",
592+
"deleteMatchButtonLabel": "Delete Match",
593+
"errorSnackbarMessage": "Error: {error}",
594+
"@errorSnackbarMessage": {
595+
"description": "Snackbar error message with error details",
596+
"placeholders": {
597+
"error": {}
598+
}
599+
}
586600
}
601+

lib/l10n/arb/app_localizations.dart

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,54 @@ abstract class AppLocalizations {
640640
/// In en, this message translates to:
641641
/// **'Feature Coming Soon!'**
642642
String get comingSoonText;
643+
644+
/// No description provided for @achievementColumnHeader.
645+
///
646+
/// In en, this message translates to:
647+
/// **'Achievement'**
648+
String get achievementColumnHeader;
649+
650+
/// No description provided for @youTooltip.
651+
///
652+
/// In en, this message translates to:
653+
/// **'You'**
654+
String get youTooltip;
655+
656+
/// No description provided for @wentFirstTooltip.
657+
///
658+
/// In en, this message translates to:
659+
/// **'Went First'**
660+
String get wentFirstTooltip;
661+
662+
/// No description provided for @deleteMatchDialogTitle.
663+
///
664+
/// In en, this message translates to:
665+
/// **'Delete Match'**
666+
String get deleteMatchDialogTitle;
667+
668+
/// No description provided for @deleteMatchDialogContent.
669+
///
670+
/// In en, this message translates to:
671+
/// **'Are you sure you want to delete this match?'**
672+
String get deleteMatchDialogContent;
673+
674+
/// No description provided for @cancelButtonLabel.
675+
///
676+
/// In en, this message translates to:
677+
/// **'Cancel'**
678+
String get cancelButtonLabel;
679+
680+
/// No description provided for @deleteMatchButtonLabel.
681+
///
682+
/// In en, this message translates to:
683+
/// **'Delete Match'**
684+
String get deleteMatchButtonLabel;
685+
686+
/// Snackbar error message with error details
687+
///
688+
/// In en, this message translates to:
689+
/// **'Error: {error}'**
690+
String errorSnackbarMessage(Object error);
643691
}
644692

645693
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {

lib/l10n/arb/app_localizations_en.dart

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,4 +296,30 @@ class AppLocalizationsEn extends AppLocalizations {
296296

297297
@override
298298
String get comingSoonText => 'Feature Coming Soon!';
299+
300+
@override
301+
String get achievementColumnHeader => 'Achievement';
302+
303+
@override
304+
String get youTooltip => 'You';
305+
306+
@override
307+
String get wentFirstTooltip => 'Went First';
308+
309+
@override
310+
String get deleteMatchDialogTitle => 'Delete Match';
311+
312+
@override
313+
String get deleteMatchDialogContent => 'Are you sure you want to delete this match?';
314+
315+
@override
316+
String get cancelButtonLabel => 'Cancel';
317+
318+
@override
319+
String get deleteMatchButtonLabel => 'Delete Match';
320+
321+
@override
322+
String errorSnackbarMessage(Object error) {
323+
return 'Error: $error';
324+
}
299325
}

lib/l10n/arb/app_localizations_es.dart

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,4 +296,30 @@ class AppLocalizationsEs extends AppLocalizations {
296296

297297
@override
298298
String get comingSoonText => 'Feature Coming Soon!';
299+
300+
@override
301+
String get achievementColumnHeader => 'Achievement';
302+
303+
@override
304+
String get youTooltip => 'You';
305+
306+
@override
307+
String get wentFirstTooltip => 'Went First';
308+
309+
@override
310+
String get deleteMatchDialogTitle => 'Delete Match';
311+
312+
@override
313+
String get deleteMatchDialogContent => 'Are you sure you want to delete this match?';
314+
315+
@override
316+
String get cancelButtonLabel => 'Cancel';
317+
318+
@override
319+
String get deleteMatchButtonLabel => 'Delete Match';
320+
321+
@override
322+
String errorSnackbarMessage(Object error) {
323+
return 'Error: $error';
324+
}
299325
}

lib/match_details/view/match_details_page.dart

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class MatchDetailsView extends StatelessWidget {
6969
} else if (state is MatchDetailsError) {
7070
ScaffoldMessenger.of(context).showSnackBar(
7171
SnackBar(
72-
content: Text('Error: ${state.error}'),
72+
content: Text(context.l10n.errorSnackbarMessage(state.error)),
7373
backgroundColor: Colors.red,
7474
duration: const Duration(seconds: 2),
7575
),
@@ -479,7 +479,7 @@ class MatchStandingsWidget extends StatelessWidget {
479479
Expanded(
480480
flex: 2,
481481
child: Text(
482-
'Achievement',
482+
context.l10n.achievementColumnHeader,
483483
style: Theme.of(context).textTheme.titleSmall?.copyWith(
484484
color: Theme.of(context).colorScheme.secondary,
485485
),
@@ -513,48 +513,40 @@ class MatchStandingsWidget extends StatelessWidget {
513513
),
514514
Expanded(
515515
flex: 2,
516-
child: Wrap(
516+
child: Row(
517517
spacing: 8,
518518
children: [
519-
if (player.firebaseId == currentUserFirebaseId)
520-
const Tooltip(
521-
triggerMode: TooltipTriggerMode.tap,
522-
message: 'You',
523-
child: Icon(
524-
Icons.person,
525-
color: Colors.blue,
519+
if (player.firebaseId != currentUserFirebaseId)
520+
IconButton(
521+
onPressed: () => onSelectPlayer(player),
522+
icon: const FaIcon(
523+
FontAwesomeIcons.userPlus,
524+
color: Colors.grey,
525+
size: 16,
526526
),
527527
),
528-
if (player.id == winner.id)
529-
const Tooltip(
528+
if (player.firebaseId == currentUserFirebaseId)
529+
Tooltip(
530530
triggerMode: TooltipTriggerMode.tap,
531-
message: 'Winner',
532-
child: Icon(
533-
Icons.emoji_events,
534-
color: Colors.amber,
535-
size: 16,
531+
message: l10n.youTooltip,
532+
child: const IconButton(
533+
icon: Icon(
534+
Icons.person,
535+
color: Colors.blue,
536+
),
537+
onPressed: null,
536538
),
537539
),
538540
if (player.id == startingPlayerId)
539-
const Tooltip(
541+
Tooltip(
540542
triggerMode: TooltipTriggerMode.tap,
541-
message: 'Went First',
542-
child: FaIcon(
543+
message: l10n.wentFirstTooltip,
544+
child: const FaIcon(
543545
FontAwesomeIcons.one,
544546
color: Colors.green,
545547
size: 16,
546548
),
547549
),
548-
if (player.firebaseId != currentUserFirebaseId)
549-
const Tooltip(
550-
triggerMode: TooltipTriggerMode.tap,
551-
message: 'Went First',
552-
child: FaIcon(
553-
FontAwesomeIcons.userPlus,
554-
color: Colors.grey,
555-
size: 16,
556-
),
557-
),
558550
],
559551
),
560552
),
@@ -668,17 +660,17 @@ class _DeleteMatchButton extends StatelessWidget {
668660
child: StatefulBuilder(
669661
builder: (context, setState) {
670662
return AlertDialog(
671-
title: const Text('Delete Match'),
672-
content: const Text(
673-
'Are you sure you want to delete this match?',
663+
title: Text(context.l10n.deleteMatchDialogTitle),
664+
content: Text(
665+
context.l10n.deleteMatchDialogContent,
674666
),
675667
actions: [
676668
ElevatedButton(
677669
onPressed: () => context.pop(),
678-
child: const Text('Cancel'),
670+
child: Text(context.l10n.cancelButtonLabel),
679671
),
680672
HoldToConfirmButton(
681-
child: const Text('Delete Match'),
673+
child: Text(context.l10n.deleteMatchButtonLabel),
682674
onProgressCompleted: () async {
683675
context.read<MatchDetailsBloc>().add(
684676
DeleteMatchEvent(

0 commit comments

Comments
 (0)