From defecf958a8bf2501ed57deedf2a9a2bdf7ea56a Mon Sep 17 00:00:00 2001 From: Patryk Hegenberg Date: Wed, 21 Jan 2026 09:51:04 +0100 Subject: [PATCH] feat: addn more localization based texts to support german and english --- lib/l10n/app_de.arb | 24 ++++++++++++++++- lib/l10n/app_en.arb | 26 +++++++++++++++++-- .../presentation/screens/hub_screen.dart | 26 ++++++++++--------- .../presentation/screens/lobby_screen.dart | 19 +++++++------- 4 files changed, 71 insertions(+), 24 deletions(-) diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 1eef152..39d31f8 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -361,5 +361,27 @@ "consentAnd": " und die ", "consentTermsOfService": "Nutzungsbedingungen", "consentRequired": "Du musst die Datenschutzerklärung und Nutzungsbedingungen akzeptieren", - "termsOfServiceTitle": "Nutzungsbedingungen" + "termsOfServiceTitle": "Nutzungsbedingungen", + + "multiplayerTitle": "MULTIPLAYER RAID", + "multiplayerDescription": "Verbünde dich mit anderen Helden, um epische Bosse zu besiegen!", + "multiplayerJoinButton": "PARTY BEITRETEN", + "multiplayerCreateButton": "PARTY ERSTELLEN", + "multiplayerEnterCodeTitle": "PARTY-CODE EINGEBEN", + "multiplayerCodeHint": "z.B. A1B2", + "multiplayerJoinAction": "BEITRETEN", + "multiplayerCancelAction": "ABBRECHEN", + + "lobbyTitle": "RAID LOBBY", + "lobbyPartyCode": "PARTY CODE", + "lobbyTapToCopy": "(Tippen zum Kopieren)", + "lobbyCodeCopied": "Code kopiert!", + "lobbyStartRaid": "RAID STARTEN", + "lobbyReady": "BEREIT", + "lobbyNotReady": "NICHT BEREIT", + "lobbyStatusActive": "Raid startet...", + "lobbyStatusEntering": "Betrete das Schlachtfeld...", + + "connectivityError": "Keine Internetverbindung verfügbar.", + "connectivityMultiplayerError": "Für Multiplayer wird eine Internetverbindung benötigt." } diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 19b7e16..f9134ff 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -370,10 +370,32 @@ }, "deleteAccountConfirmationMismatch": "Confirmation text does not match", - "consentAcceptPrefix": "I accept the ", + "consentAcceptPrefix": "I accept the ", "consentPrivacyPolicy": "Privacy Policy", "consentAnd": " and ", "consentTermsOfService": "Terms of Service", "consentRequired": "You must accept the privacy policy and terms to continue", - "termsOfServiceTitle": "Terms of Service" + "termsOfServiceTitle": "Terms of Service", + + "multiplayerTitle": "MULTIPLAYER RAID", + "multiplayerDescription": "Join forces with other heroes to defeat epic bosses!", + "multiplayerJoinButton": "JOIN PARTY", + "multiplayerCreateButton": "CREATE PARTY", + "multiplayerEnterCodeTitle": "ENTER PARTY CODE", + "multiplayerCodeHint": "e.g. A1B2", + "multiplayerJoinAction": "JOIN", + "multiplayerCancelAction": "CANCEL", + + "lobbyTitle": "RAID LOBBY", + "lobbyPartyCode": "PARTY CODE", + "lobbyTapToCopy": "(Tap to copy)", + "lobbyCodeCopied": "Code copied!", + "lobbyStartRaid": "START RAID", + "lobbyReady": "READY", + "lobbyNotReady": "NOT READY", + "lobbyStatusActive": "Raid is starting...", + "lobbyStatusEntering": "Entering Battle...", + + "connectivityError": "No internet connection available.", + "connectivityMultiplayerError": "Active internet connection required for multiplayer." } diff --git a/lib/src/features/dashboard/presentation/screens/hub_screen.dart b/lib/src/features/dashboard/presentation/screens/hub_screen.dart index b6de5df..dca520c 100644 --- a/lib/src/features/dashboard/presentation/screens/hub_screen.dart +++ b/lib/src/features/dashboard/presentation/screens/hub_screen.dart @@ -58,9 +58,9 @@ class _HubScreenState extends ConsumerState { if (!hasInternet) { if (mounted) { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( + SnackBar( content: Text( - 'Für Multiplayer wird eine aktive Internetverbindung benötigt.'), //TODO: make this in l10n + AppLocalizations.of(context)!.connectivityMultiplayerError), backgroundColor: AppTheme.errorColor, behavior: SnackBarBehavior.floating, ), @@ -250,19 +250,20 @@ class _HubScreenState extends ConsumerState { } void _showMultiplayerDialog() { + final l10n = AppLocalizations.of(context)!; + showDialog( context: context, builder: (context) => AlertDialog( - title: const Text('MULTIPLAYER RAID'), - content: - const Text('Join forces with other heroes to defeat epic bosses!'), + title: Text(l10n.multiplayerTitle), + content: Text(l10n.multiplayerDescription), actions: [ TextButton( onPressed: () { Navigator.pop(context); _showJoinCodeDialog(); }, - child: const Text('JOIN PARTY'), + child: Text(l10n.multiplayerJoinButton), ), ElevatedButton( style: ElevatedButton.styleFrom( @@ -280,7 +281,7 @@ class _HubScreenState extends ConsumerState { } } }, - child: const Text('CREATE PARTY', + child: Text(l10n.multiplayerCreateButton, style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold)), ), @@ -290,23 +291,24 @@ class _HubScreenState extends ConsumerState { } void _showJoinCodeDialog() { + final l10n = AppLocalizations.of(context)!; final controller = TextEditingController(); showDialog( context: context, builder: (context) => AlertDialog( - title: const Text('ENTER PARTY CODE'), + title: Text(l10n.multiplayerEnterCodeTitle), content: TextField( controller: controller, textCapitalization: TextCapitalization.characters, - decoration: const InputDecoration( - hintText: 'e.g. A1B2', + decoration: InputDecoration( + hintText: l10n.multiplayerCodeHint, border: OutlineInputBorder(), ), ), actions: [ TextButton( onPressed: () => Navigator.pop(context), - child: const Text('CANCEL'), + child: Text(l10n.multiplayerCancelAction), ), ElevatedButton( onPressed: () async { @@ -325,7 +327,7 @@ class _HubScreenState extends ConsumerState { } } }, - child: const Text('JOIN'), + child: Text(l10n.multiplayerJoinAction), ), ], ), diff --git a/lib/src/features/multiplayer/presentation/screens/lobby_screen.dart b/lib/src/features/multiplayer/presentation/screens/lobby_screen.dart index 6b90acd..327ee26 100644 --- a/lib/src/features/multiplayer/presentation/screens/lobby_screen.dart +++ b/lib/src/features/multiplayer/presentation/screens/lobby_screen.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; import 'package:flutter/services.dart'; +import 'package:slrpg_app/l10n/app_localizations.dart'; import 'package:slrpg_app/src/shared/data/repositories/workout_repository.dart'; import '../../../../core/theme/app_theme.dart'; import '../../../../shared/data/repositories/user_repository.dart'; @@ -41,10 +42,11 @@ class _LobbyScreenState extends ConsumerState { final partyAsync = ref.watch(partyStreamProvider(widget.partyId)); final membersAsync = ref.watch(partyMembersStreamProvider(widget.partyId)); final currentUser = ref.watch(userRepositoryProvider).getLocalUser(); + final l10n = AppLocalizations.of(context)!; return Scaffold( appBar: AppBar( - title: const Text('RAID LOBBY'), + title: Text(l10n.lobbyTitle), centerTitle: true, leading: IconButton( icon: const Icon(Icons.arrow_back), @@ -71,8 +73,7 @@ class _LobbyScreenState extends ConsumerState { }); return const Center(child: Text('Entering Battle...')); } - return const Center( - child: Text('Raid is starting... Preparing workout...')); + return Center(child: Text(l10n.lobbyStatusActive)); }, ); } @@ -85,14 +86,14 @@ class _LobbyScreenState extends ConsumerState { color: AppTheme.surfaceColor, child: Column( children: [ - const Text('PARTY CODE', + Text(l10n.lobbyPartyCode, style: TextStyle(color: Colors.grey)), const SizedBox(height: 8), InkWell( onTap: () { Clipboard.setData(ClipboardData(text: party.code)); ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text('Code copied!')), + SnackBar(content: Text(l10n.lobbyCodeCopied)), ); }, child: Text( @@ -105,7 +106,7 @@ class _LobbyScreenState extends ConsumerState { ), ), ), - const Text('(Tap to copy)', + Text(l10n.lobbyTapToCopy, style: TextStyle(fontSize: 12, color: Colors.grey)), ], ), @@ -161,7 +162,7 @@ class _LobbyScreenState extends ConsumerState { .setReady(party.id, !isReady); }, child: Text( - isReady ? 'READY' : 'NOT READY', + isReady ? l10n.lobbyNotReady : l10n.lobbyReady, style: const TextStyle(fontWeight: FontWeight.bold), ), @@ -188,8 +189,8 @@ class _LobbyScreenState extends ConsumerState { // .read(partyRepositoryProvider) // .startRaid(party.id); }, - child: const Text( - 'START RAID', + child: Text( + l10n.lobbyStartRaid, style: TextStyle( fontWeight: FontWeight.bold, color: Colors.white),