Add i18n support and integrate localized strings across modules (Login, AppShell, etc.)

This commit is contained in:
2025-09-27 12:15:57 +02:00
parent 0a0e421158
commit 140e3a7328
8 changed files with 576 additions and 71 deletions

View File

@@ -1,4 +1,5 @@
import 'package:app/core/app/router.dart';
import 'package:app/core/i18n/translations.g.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
@@ -28,9 +29,10 @@ class _LoginPageState extends State<LoginPage> {
@override
Widget build(BuildContext context) {
final t = Translations.of(context);
final theme = Theme.of(context);
return Scaffold(
appBar: AppBar(title: const Text('Login')),
appBar: AppBar(title: Text(t.login.title)),
body: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 360),
@@ -39,7 +41,7 @@ class _LoginPageState extends State<LoginPage> {
children: [
const FlutterLogo(size: 64),
const SizedBox(height: 24),
Text('Please sign in', style: theme.textTheme.titleMedium),
Text(t.login.pleaseSignIn, style: theme.textTheme.titleMedium),
const SizedBox(height: 24),
SizedBox(
width: double.infinity,
@@ -56,7 +58,7 @@ class _LoginPageState extends State<LoginPage> {
height: 20,
child: CircularProgressIndicator(strokeWidth: 2),
)
: const Text('Login', key: ValueKey('text')),
: Text(t.login.title, key: const ValueKey('text')),
),
),
),
@@ -67,7 +69,7 @@ class _LoginPageState extends State<LoginPage> {
? Padding(
padding: const EdgeInsets.only(top: 4),
child: Text(
'Signing you in…',
t.login.signingIn,
style: theme.textTheme.bodySmall,
),
)