feat(i18n): add FR/EN internationalization with in-app language selector
- gen-l10n setup (flutter_localizations, intl, l10n.yaml, ARB en/fr) - localeProvider (persisted) wired into MaterialApp - language selector in the System page (alongside the color palette) - all user-facing strings across screens moved to AppLocalizations Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../core/config/app_constants.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
|
||||
/// Bouton "GEN FILTER" et son panneau dépliable de sélection des générations.
|
||||
class GenFilterSection extends StatelessWidget {
|
||||
@@ -30,9 +31,9 @@ class GenFilterSection extends StatelessWidget {
|
||||
isOpen ? Icons.expand_less : Icons.filter_list,
|
||||
color: const Color(0xFF1B2333),
|
||||
),
|
||||
label: const Text(
|
||||
'GEN FILTER',
|
||||
style: TextStyle(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.genFilter,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFF1B2333),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
|
||||
/// Section de saisie : indice optionnel, champ de réponse et boutons d'action
|
||||
/// (Guess / Continue / Hint / Skip). Purement présentationnelle : tout passe par les callbacks.
|
||||
@@ -36,14 +37,15 @@ class GuessInputSection extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l = AppLocalizations.of(context)!;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
"IDENTIFICATION INPUT",
|
||||
style: TextStyle(color: Colors.black54, fontSize: 12, fontWeight: FontWeight.bold),
|
||||
Text(
|
||||
l.identificationInput,
|
||||
style: const TextStyle(color: Colors.black54, fontSize: 12, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
if (isHintUsed)
|
||||
@@ -57,7 +59,7 @@ class GuessInputSection extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
"HINT: ${_maskedName(pokemonName)}",
|
||||
"${l.hintPrefix}: ${_maskedName(pokemonName)}",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold, color: Colors.amber[900], letterSpacing: 4),
|
||||
),
|
||||
@@ -67,28 +69,28 @@ class GuessInputSection extends StatelessWidget {
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
style: const TextStyle(fontSize: 24, letterSpacing: 1.5),
|
||||
decoration: const InputDecoration(
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
border: InputBorder.none,
|
||||
hintText: 'Enter Pokémon name...',
|
||||
hintText: l.enterPokemonName,
|
||||
),
|
||||
onSubmitted: (_) => onGuess(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (isGuessed)
|
||||
_bigButton(label: "CONTINUE", color: Colors.green, onPressed: onContinue)
|
||||
_bigButton(label: l.continueButton, color: Colors.green, onPressed: onContinue)
|
||||
else ...[
|
||||
_bigButton(label: "GUESS!", color: const Color(0xFF3B6EE3), onPressed: onGuess),
|
||||
_bigButton(label: l.guessButton, color: const Color(0xFF3B6EE3), onPressed: onGuess),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _actionButton(icon: Icons.lightbulb, label: "HINT ($hints)", color: Colors.amber, onPressed: onHint),
|
||||
child: _actionButton(icon: Icons.lightbulb, label: l.hintButton(hints), color: Colors.amber, onPressed: onHint),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: _actionButton(icon: Icons.skip_next, label: "SKIP ($skips)", color: Colors.grey[400]!, onPressed: onSkip),
|
||||
child: _actionButton(icon: Icons.skip_next, label: l.skipButton(skips), color: Colors.grey[400]!, onPressed: onSkip),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../domain/entities/pokemon.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
import '../pokemon_image.dart';
|
||||
|
||||
/// Écran bleu affichant la silhouette (jeu en cours) ou l'image révélée (manche gagnée).
|
||||
@@ -17,6 +18,7 @@ class GuessSilhouette extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l = AppLocalizations.of(context)!;
|
||||
final imageUrl = isShiny ? pokemon.shinyImageUrl : pokemon.imageUrl;
|
||||
return Container(
|
||||
height: 250,
|
||||
@@ -53,7 +55,7 @@ class GuessSilhouette extends StatelessWidget {
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Text(
|
||||
isShiny ? "✨ SHINY POKÉMON DETECTED! ✨" : "WHO'S THAT POKÉMON?",
|
||||
isShiny ? l.shinyDetected : l.whosThatPokemon,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: isShiny ? Colors.yellow[400] : Colors.white,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
|
||||
/// Encart affichant le score courant et le meilleur score personnel.
|
||||
class ScoreBoard extends StatelessWidget {
|
||||
@@ -9,6 +10,7 @@ class ScoreBoard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l = AppLocalizations.of(context)!;
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -19,9 +21,9 @@ class ScoreBoard extends StatelessWidget {
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text(
|
||||
"CURRENT SCORE",
|
||||
style: TextStyle(color: Colors.black54, fontSize: 14, fontWeight: FontWeight.bold),
|
||||
Text(
|
||||
l.currentScore,
|
||||
style: const TextStyle(color: Colors.black54, fontSize: 14, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Text(
|
||||
"$currentScore",
|
||||
@@ -29,7 +31,7 @@ class ScoreBoard extends StatelessWidget {
|
||||
),
|
||||
const Divider(height: 24),
|
||||
Text(
|
||||
"PERSONAL BEST: $bestScore",
|
||||
l.personalBest(bestScore),
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Colors.black87),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user