feat: addn more localization based texts to support german and english

This commit is contained in:
Patryk Hegenberg 2026-01-21 09:51:04 +01:00
parent 4df2b3668f
commit defecf958a
4 changed files with 71 additions and 24 deletions

View file

@ -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."
}

View file

@ -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."
}

View file

@ -58,9 +58,9 @@ class _HubScreenState extends ConsumerState<HubScreen> {
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<HubScreen> {
}
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<HubScreen> {
}
}
},
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<HubScreen> {
}
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<HubScreen> {
}
}
},
child: const Text('JOIN'),
child: Text(l10n.multiplayerJoinAction),
),
],
),

View file

@ -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<LobbyScreen> {
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<LobbyScreen> {
});
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<LobbyScreen> {
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<LobbyScreen> {
),
),
),
const Text('(Tap to copy)',
Text(l10n.lobbyTapToCopy,
style: TextStyle(fontSize: 12, color: Colors.grey)),
],
),
@ -161,7 +162,7 @@ class _LobbyScreenState extends ConsumerState<LobbyScreen> {
.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<LobbyScreen> {
// .read(partyRepositoryProvider)
// .startRaid(party.id);
},
child: const Text(
'START RAID',
child: Text(
l10n.lobbyStartRaid,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white),