From 4f41aff572e752a13fc5b850c3377af75804633e Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Mon, 30 Jun 2025 23:25:56 +0200 Subject: [PATCH 01/38] change button language --- covas_mobile/l10n.yaml | 4 +++ covas_mobile/lib/classes/MyDrawer.dart | 39 ++++++++++++++++++++++++ covas_mobile/lib/l10n/app_en.arb | 4 +++ covas_mobile/lib/l10n/app_fr.arb | 4 +++ covas_mobile/lib/locale_provider.dart | 21 +++++++++++++ covas_mobile/lib/main.dart | 10 +++++- covas_mobile/lib/pages/ListItemMenu.dart | 21 +++++++++---- covas_mobile/pubspec.lock | 16 ++++++++++ covas_mobile/pubspec.yaml | 1 + 9 files changed, 113 insertions(+), 7 deletions(-) create mode 100644 covas_mobile/l10n.yaml create mode 100644 covas_mobile/lib/l10n/app_en.arb create mode 100644 covas_mobile/lib/l10n/app_fr.arb create mode 100644 covas_mobile/lib/locale_provider.dart diff --git a/covas_mobile/l10n.yaml b/covas_mobile/l10n.yaml new file mode 100644 index 0000000..1437ccc --- /dev/null +++ b/covas_mobile/l10n.yaml @@ -0,0 +1,4 @@ +arb-dir: lib/l10n +template-arb-file: app_en.arb +output-localization-file: app_localizations.dart +output-class: AppLocalizations diff --git a/covas_mobile/lib/classes/MyDrawer.dart b/covas_mobile/lib/classes/MyDrawer.dart index 27cfe5e..8fea215 100644 --- a/covas_mobile/lib/classes/MyDrawer.dart +++ b/covas_mobile/lib/classes/MyDrawer.dart @@ -13,6 +13,9 @@ import '../pages/LoginDemo.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; // Import dotenv import 'package:encrypt_shared_preferences/provider.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; + class MyDrawer extends StatelessWidget with ShowAlertDialog { Future logout(BuildContext context) async { SharedPreferences prefs = await SharedPreferences.getInstance(); @@ -135,6 +138,42 @@ class MyDrawer extends StatelessWidget with ShowAlertDialog { builder: (_) => EditProfile())); // Close the drawer }, ), + ListTile( + leading: Icon(Icons.language), + title: Text('Language'), + onTap: () { + showDialog( + context: context, + builder: (_) => AlertDialog( + title: Text('Select Language'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ListTile( + leading: Icon(Icons.flag), + title: Text('Français'), + onTap: () { + Provider.of(context, listen: false) + .setLocale(const Locale('fr')); + Navigator.of(context).pop(); + }, + ), + ListTile( + leading: Icon(Icons.flag_outlined), + title: Text('English'), + onTap: () { + Provider.of(context, listen: false) + .setLocale(const Locale('en')); + Navigator.of(context).pop(); + }, + ), + ], + ), + ), + ); + }, + ), + ListTile( leading: Icon(Icons.info), title: Text('About'), diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb new file mode 100644 index 0000000..a4abd5e --- /dev/null +++ b/covas_mobile/lib/l10n/app_en.arb @@ -0,0 +1,4 @@ +{ + "@@locale": "en", +"menu_list": "Event list menu" +} \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb new file mode 100644 index 0000000..ca19c58 --- /dev/null +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -0,0 +1,4 @@ +{ + "@@locale": "fr", +"menu_list": "Liste d'évènement" +} \ No newline at end of file diff --git a/covas_mobile/lib/locale_provider.dart b/covas_mobile/lib/locale_provider.dart new file mode 100644 index 0000000..b8c9c7a --- /dev/null +++ b/covas_mobile/lib/locale_provider.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; + +class LocaleProvider with ChangeNotifier { + Locale _locale = const Locale('en'); + + Locale get locale => _locale; + + void setLocale(Locale locale) { + if (!L10n.all.contains(locale)) return; + + _locale = locale; + notifyListeners(); + } +} + +class L10n { + static final all = [ + const Locale('en'), + const Locale('fr'), + ]; +} diff --git a/covas_mobile/lib/main.dart b/covas_mobile/lib/main.dart index 76ea006..9f4634a 100644 --- a/covas_mobile/lib/main.dart +++ b/covas_mobile/lib/main.dart @@ -1,12 +1,20 @@ import 'package:flutter/material.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; +import 'package:provider/provider.dart'; + import 'pages/LoginDemo.dart'; +import 'locale_provider.dart'; // <-- à adapter selon ton arborescence void main() async { WidgetsFlutterBinding.ensureInitialized(); await MobileAds.instance.initialize(); - runApp(MyApp()); + runApp( + ChangeNotifierProvider( + create: (_) => LocaleProvider(), + child: MyApp(), + ), + ); } class MyApp extends StatelessWidget { diff --git a/covas_mobile/lib/pages/ListItemMenu.dart b/covas_mobile/lib/pages/ListItemMenu.dart index 521816e..42bd752 100644 --- a/covas_mobile/lib/pages/ListItemMenu.dart +++ b/covas_mobile/lib/pages/ListItemMenu.dart @@ -20,6 +20,9 @@ import '../classes/ad_helper.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import '../classes/auth_service.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // Créé plus loin void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -27,7 +30,10 @@ void main() async { await MobileAds.instance.initialize(); await initializeDateFormatting("fr_FR", null); - runApp(const MyApp()); + runApp(ChangeNotifierProvider( + create: (_) => LocaleProvider(), + child: const MyApp(), + )); } class MyApp extends StatelessWidget { @@ -35,16 +41,17 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { + final localeProvider = Provider.of(context); return MaterialApp( localizationsDelegates: [ + AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], - supportedLocales: [ - const Locale('fr', 'FR'), - ], - home: const ListItemMenu(), + supportedLocales: [const Locale('fr', 'FR'), const Locale('en')], + locale: localeProvider.locale, + home: Builder(builder: (context) => ListItemMenu()), debugShowCheckedModeBanner: false, ); } @@ -608,9 +615,11 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { + final loc = AppLocalizations.of(context); + final localeProvider = Provider.of(context); return Scaffold( appBar: AppBar( - title: const Text("Item list menu"), + title: Text(loc?.menu_list ?? "Item list menu"), backgroundColor: Colors.blue, foregroundColor: Colors.white, ), diff --git a/covas_mobile/pubspec.lock b/covas_mobile/pubspec.lock index 292dc71..311394d 100644 --- a/covas_mobile/pubspec.lock +++ b/covas_mobile/pubspec.lock @@ -565,6 +565,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.6" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" path: dependency: "direct main" description: @@ -701,6 +709,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.9.1" + provider: + dependency: "direct main" + description: + name: provider + sha256: "4abbd070a04e9ddc287673bf5a030c7ca8b685ff70218720abab8b092f53dd84" + url: "https://pub.dev" + source: hosted + version: "6.1.5" shared_preferences: dependency: "direct main" description: diff --git a/covas_mobile/pubspec.yaml b/covas_mobile/pubspec.yaml index 6e0737c..614bc53 100644 --- a/covas_mobile/pubspec.yaml +++ b/covas_mobile/pubspec.yaml @@ -55,6 +55,7 @@ dependencies: mapbox_gl: ^0.16.0 google_mobile_ads: ^5.3.1 encrypt_shared_preferences: ^0.8.8 + provider: ^6.1.2 # ou la dernière version dev_dependencies: flutter_test: -- 2.49.1 From e2195e6500a7f57b636c31aae2a00780b587af5a Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 2 Jul 2025 22:03:51 +0200 Subject: [PATCH 02/38] change language ok --- covas_mobile/lib/main.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/covas_mobile/lib/main.dart b/covas_mobile/lib/main.dart index 9f4634a..11346a0 100644 --- a/covas_mobile/lib/main.dart +++ b/covas_mobile/lib/main.dart @@ -4,6 +4,7 @@ import 'package:provider/provider.dart'; import 'pages/LoginDemo.dart'; import 'locale_provider.dart'; // <-- à adapter selon ton arborescence +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -20,8 +21,16 @@ void main() async { class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { + final localeProvider = Provider.of( + context); // écoute les changements de langue return MaterialApp( debugShowCheckedModeBanner: false, + locale: localeProvider.locale, // <-- utilise la locale courante + supportedLocales: const [ + Locale('en'), + Locale('fr'), + ], + localizationsDelegates: AppLocalizations.localizationsDelegates, home: LoginDemo(), ); } -- 2.49.1 From 75b443758a143a92fc00b8db6b93bfe6a2ff077a Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 2 Jul 2025 22:35:53 +0200 Subject: [PATCH 03/38] changement de langue ok sur drawer --- covas_mobile/lib/classes/MyDrawer.dart | 25 +++++++++++++----------- covas_mobile/lib/l10n/app_en.arb | 11 ++++++++++- covas_mobile/lib/l10n/app_fr.arb | 11 ++++++++++- covas_mobile/lib/pages/ListItemMenu.dart | 5 ++++- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/covas_mobile/lib/classes/MyDrawer.dart b/covas_mobile/lib/classes/MyDrawer.dart index 8fea215..6272d76 100644 --- a/covas_mobile/lib/classes/MyDrawer.dart +++ b/covas_mobile/lib/classes/MyDrawer.dart @@ -15,6 +15,7 @@ import 'package:encrypt_shared_preferences/provider.dart'; import 'package:provider/provider.dart'; import '../locale_provider.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class MyDrawer extends StatelessWidget with ShowAlertDialog { Future logout(BuildContext context) async { @@ -90,6 +91,8 @@ class MyDrawer extends StatelessWidget with ShowAlertDialog { @override Widget build(BuildContext context) { + final loc = AppLocalizations.of(context); + final localeProvider = Provider.of(context); return Drawer( child: ListView( padding: EdgeInsets.zero, @@ -110,7 +113,7 @@ class MyDrawer extends StatelessWidget with ShowAlertDialog { // Drawer Items ListTile( leading: Icon(Icons.home), - title: Text('Home'), + title: Text(loc?.home ?? "Home"), onTap: () { Navigator.pushReplacement( context, MaterialPageRoute(builder: (_) => ListItemMenu())); @@ -120,7 +123,7 @@ class MyDrawer extends StatelessWidget with ShowAlertDialog { ), ListTile( leading: Icon(Icons.settings), - title: Text('Settings'), + title: Text(loc?.settings ?? 'Settings'), onTap: () { Navigator.pushReplacement( context, @@ -130,7 +133,7 @@ class MyDrawer extends StatelessWidget with ShowAlertDialog { ), ListTile( leading: Icon(Icons.account_circle), - title: Text('Update profile'), + title: Text(loc?.update_profile ?? 'Update profile'), onTap: () { Navigator.pushReplacement( context, @@ -140,18 +143,18 @@ class MyDrawer extends StatelessWidget with ShowAlertDialog { ), ListTile( leading: Icon(Icons.language), - title: Text('Language'), + title: Text(loc?.language ?? 'Language'), onTap: () { showDialog( context: context, builder: (_) => AlertDialog( - title: Text('Select Language'), + title: Text(loc?.select_language ?? 'Select Language'), content: Column( mainAxisSize: MainAxisSize.min, children: [ ListTile( leading: Icon(Icons.flag), - title: Text('Français'), + title: Text(loc?.french ?? 'Français'), onTap: () { Provider.of(context, listen: false) .setLocale(const Locale('fr')); @@ -160,7 +163,7 @@ class MyDrawer extends StatelessWidget with ShowAlertDialog { ), ListTile( leading: Icon(Icons.flag_outlined), - title: Text('English'), + title: Text(loc?.english ?? 'English'), onTap: () { Provider.of(context, listen: false) .setLocale(const Locale('en')); @@ -176,15 +179,15 @@ class MyDrawer extends StatelessWidget with ShowAlertDialog { ListTile( leading: Icon(Icons.info), - title: Text('About'), + title: Text(loc?.about ?? 'About'), onTap: () { - showAlertDialog( - context, 'About', "Version 0.0.1"); // Close the drawer + showAlertDialog(context, loc?.about ?? 'About', + "Version 0.0.1"); // Close the drawer }, ), ListTile( leading: Icon(Icons.logout), - title: Text('Log out'), + title: Text(loc?.log_out ?? 'Log out'), onTap: () async { logout(context); // Close the drawer diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index a4abd5e..84846c5 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -1,4 +1,13 @@ { "@@locale": "en", -"menu_list": "Event list menu" +"menu_list": "Event list menu", +"language": "Language", +"home": "Home", +"settings": "Settings", +"update_profile": "Update profile", +"about": "About", +"log_out": "Log out", +"french": "French", +"english": "English", +"select_language": "Select language" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index ca19c58..688bc22 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -1,4 +1,13 @@ { "@@locale": "fr", -"menu_list": "Liste d'évènement" +"menu_list": "Liste d'évènement", +"language": "Langue", +"home": "Accueil", +"settings": "Paramètres", +"update_profile": "Modifier profil", +"about": "À propos", +"log_out": "Se déconnecter", +"french": "Français", +"english": "Anglais", +"select_language": "Selectionne la langue" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/ListItemMenu.dart b/covas_mobile/lib/pages/ListItemMenu.dart index 42bd752..0f42de4 100644 --- a/covas_mobile/lib/pages/ListItemMenu.dart +++ b/covas_mobile/lib/pages/ListItemMenu.dart @@ -864,8 +864,11 @@ class _MyHomePageState extends State { final startDate = DateTime.parse(post.startDate!); //final date = DateFormat.yMd().format(startDate); //final time = DateFormat.Hm().format(startDate); + final locale = + Provider.of(context).locale?.toString() ?? + 'en_US'; final dateLongue = - DateFormat('EEEE d MMMM y', 'fr_FR').format(startDate); + DateFormat('EEEE d MMMM y', locale).format(startDate); return ListTile( title: Text('${post.name!}'), subtitle: Text('${post.place!}\n${dateLongue}'), -- 2.49.1 From 45cdb253e4cde7514dbc16b255f0600ca7a87a1a Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 6 Jul 2025 20:59:57 +0200 Subject: [PATCH 04/38] internationlization wip --- covas_mobile/lib/l10n/app_en.arb | 4 +++- covas_mobile/lib/l10n/app_fr.arb | 4 +++- covas_mobile/lib/pages/ListItemMenu.dart | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 84846c5..30148c9 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -9,5 +9,7 @@ "log_out": "Log out", "french": "French", "english": "English", -"select_language": "Select language" +"select_language": "Select language", +"search_item": "Search by item", +"search_tag": "Search by tags" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 688bc22..1e32e7b 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -9,5 +9,7 @@ "log_out": "Se déconnecter", "french": "Français", "english": "Anglais", -"select_language": "Selectionne la langue" +"select_language": "Selectionne la langue", +"search_item": "Recherche par item", +"search_tag": "Recherche par tags" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/ListItemMenu.dart b/covas_mobile/lib/pages/ListItemMenu.dart index 0f42de4..d22f387 100644 --- a/covas_mobile/lib/pages/ListItemMenu.dart +++ b/covas_mobile/lib/pages/ListItemMenu.dart @@ -636,7 +636,7 @@ class _MyHomePageState extends State { if (showInputSearch) _buildSearchField( controller: inputItem, - labelText: 'Search by item', + labelText: loc?.search_item ?? "Search by item", onChanged: (value) { _fetchCount = 0; if (value.isNotEmpty) { @@ -682,7 +682,7 @@ class _MyHomePageState extends State { if ((showDateFields) && (showInputTag)) _buildSearchField( controller: inputTags, - labelText: 'Search by tags', + labelText: loc?.search_tag ?? "Search by tags", onChanged: (value) { _fetchCount = 0; if (value.isNotEmpty) { -- 2.49.1 From e21b03d13c27d12219f4083cfd98689dace5aac4 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 9 Jul 2025 23:05:50 +0200 Subject: [PATCH 05/38] full translate for ItemListMenu pages --- covas_mobile/lib/l10n/app_en.arb | 8 +++++++- covas_mobile/lib/l10n/app_fr.arb | 8 +++++++- covas_mobile/lib/pages/ListItemMenu.dart | 25 ++++++++++++++---------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 30148c9..894ba7b 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -11,5 +11,11 @@ "english": "English", "select_language": "Select language", "search_item": "Search by item", -"search_tag": "Search by tags" +"search_tag": "Search by tags", +"search_geographical": "Search by geographical zone", +"show_date_field": "Show Date Fields", +"hide_date_field": "Hide Date Fields", +"no_data": "No data available", +"search": "Search", +"no_events": "No events available for this location." } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 1e32e7b..d85d8c2 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -11,5 +11,11 @@ "english": "Anglais", "select_language": "Selectionne la langue", "search_item": "Recherche par item", -"search_tag": "Recherche par tags" +"search_tag": "Recherche par tags", +"search_geographical": "Recherche par zone géographique", +"show_date_field": "Afficher champ date", +"hide_date_field": "Cacher Date Fields", +"no_data": "Aucune donnée disponible", +"search": "Recherche", +"no_events": "No events available for this location." } \ No newline at end of file diff --git a/covas_mobile/lib/pages/ListItemMenu.dart b/covas_mobile/lib/pages/ListItemMenu.dart index d22f387..eeb288a 100644 --- a/covas_mobile/lib/pages/ListItemMenu.dart +++ b/covas_mobile/lib/pages/ListItemMenu.dart @@ -733,7 +733,8 @@ class _MyHomePageState extends State { if ((showDateFields) && (showInputGeo)) _buildSearchField( controller: inputGeo, - labelText: 'Search by geographical zone', + labelText: + loc?.search_geographical ?? 'Search by geographical zone', onChanged: (value) async { _fetchCount = 0; @@ -804,21 +805,26 @@ class _MyHomePageState extends State { : Icons.keyboard_arrow_down, color: Colors.blue, ), - tooltip: showDateFields ? 'Show Date Fields' : 'Hide Date Fields', + tooltip: showDateFields + ? loc?.show_date_field ?? 'Show Date Fields' + : loc?.hide_date_field ?? 'Hide Date Fields', ), Expanded( child: FutureBuilder>( future: postsFuture, builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { - return const Center(child: CircularProgressIndicator()); + return Center(child: CircularProgressIndicator()); } else if (snapshot.hasData) { final posts = snapshot.data!; final displayedPosts = filteredPosts.isEmpty ? posts : filteredPosts; return buildPosts(displayedPosts); } else { - return const Text("No data available"); + return Center( + child: Text(AppLocalizations.of(context)?.no_data ?? + "No data available"), + ); } }, ), @@ -828,7 +834,7 @@ class _MyHomePageState extends State { floatingActionButton: FloatingActionButton( onPressed: popCamera, backgroundColor: Colors.blue, - tooltip: 'Recherche', + tooltip: loc?.search ?? 'Recherche', child: const Icon(Icons.photo_camera, color: Colors.white), ), ); @@ -836,14 +842,13 @@ class _MyHomePageState extends State { // Function to display fetched data on screen Widget buildPosts(List posts) { - print("posts : ${posts}"); - print("filteredposts : ${filteredPosts}"); final displayedPosts = filteredPosts; - print("results ${displayedPosts}"); // If filteredPosts is empty, show a message saying no data is available if (displayedPosts.isEmpty) { - return const Center( - child: Text('No events available for this location.', + return Center( + child: Text( + AppLocalizations.of(context)?.no_events ?? + 'No events available for this location.', style: TextStyle(fontSize: 18, color: Colors.grey)), ); } -- 2.49.1 From 1646a0b6e347963c3931accf45e04aa3fb0d3b38 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 9 Jul 2025 23:33:04 +0200 Subject: [PATCH 06/38] full translate for ItemListMenu pages 50% --- covas_mobile/lib/l10n/app_en.arb | 5 ++++- covas_mobile/lib/l10n/app_fr.arb | 5 ++++- covas_mobile/lib/pages/ListItemMenu.dart | 10 ++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 894ba7b..937b4d8 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -17,5 +17,8 @@ "hide_date_field": "Hide Date Fields", "no_data": "No data available", "search": "Search", -"no_events": "No events available for this location." +"no_events": "No events available for this location.", +"start_date": "Start date", +"end_date": "End date", +"failed_suggestions": "Failed to load suggestions" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index d85d8c2..939b4f9 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -17,5 +17,8 @@ "hide_date_field": "Cacher Date Fields", "no_data": "Aucune donnée disponible", "search": "Recherche", -"no_events": "No events available for this location." +"no_events": "Pas d'évènements dans cette localisation", +"start_date": "Date de début", +"end_date": "Date de fin", +"failed_suggestions": "Echec de chargement des suggestions" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/ListItemMenu.dart b/covas_mobile/lib/pages/ListItemMenu.dart index eeb288a..f20c68c 100644 --- a/covas_mobile/lib/pages/ListItemMenu.dart +++ b/covas_mobile/lib/pages/ListItemMenu.dart @@ -354,7 +354,8 @@ class _MyHomePageState extends State { } }); } else { - throw Exception('Failed to load suggestions'); + throw Exception(AppLocalizations.of(context)?.failed_suggestions ?? + 'Failed to load suggestions'); } } @@ -452,16 +453,13 @@ class _MyHomePageState extends State { "Content-Type": "application/json", HttpHeaders.cookieHeader: "access_token=$accessToken" }); - print("status code tags : ${response.statusCode}"); if (response.statusCode == 200) { final data = json.decode(utf8.decode(response.bodyBytes)); - print("tags ${data}"); setState(() { suggestionsTags = (data as List) .map((feature) => {'name': feature['name']}) .toList(); - print("suggesttion tag : ${suggestionsTags}"); if (suggestionsTags.isNotEmpty) { showInputGeo = false; showInputSearch = false; @@ -527,10 +525,10 @@ class _MyHomePageState extends State { Padding _buildDateField(String position) { TextEditingController datePicker = startDatepicker; - String hintText = "Date de début"; + String hintText = AppLocalizations.of(context)?.start_date ?? "Start date"; if (position == "end") { datePicker = endDatepicker; - hintText = "Date de fin"; + hintText = AppLocalizations.of(context)?.end_date ?? "End date"; } return Padding( padding: const EdgeInsets.all(8.0), -- 2.49.1 From 479ab76fb7520e9885c3d8aa85f0dfa6edc4e1fc Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Mon, 14 Jul 2025 22:53:34 +0200 Subject: [PATCH 07/38] full translate for AddProfile pages 10% --- covas_mobile/lib/l10n/app_en.arb | 6 +++++- covas_mobile/lib/l10n/app_fr.arb | 6 +++++- covas_mobile/lib/pages/AddProfile.dart | 15 +++++++++++++-- covas_mobile/lib/pages/ListItemMenu.dart | 1 - 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 937b4d8..aff4ba0 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -20,5 +20,9 @@ "no_events": "No events available for this location.", "start_date": "Start date", "end_date": "End date", -"failed_suggestions": "Failed to load suggestions" +"failed_suggestions": "Failed to load suggestions", +"error":"Error", +"password_different":"Must write a different password", +"create": "Creation", +"user_create": "Your user created" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 939b4f9..50b3777 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -20,5 +20,9 @@ "no_events": "Pas d'évènements dans cette localisation", "start_date": "Date de début", "end_date": "Date de fin", -"failed_suggestions": "Echec de chargement des suggestions" +"failed_suggestions": "Echec de chargement des suggestions", +"error":"Erreur", +"password_different":"Tu dois écrire un mot de passe different", +"create": "Création", +"user_create": "Votre utilisateur a été créé" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/AddProfile.dart b/covas_mobile/lib/pages/AddProfile.dart index 5e7c8c0..df01d9f 100644 --- a/covas_mobile/lib/pages/AddProfile.dart +++ b/covas_mobile/lib/pages/AddProfile.dart @@ -13,6 +13,10 @@ import '../variable/globals.dart' as globals; import '../classes/ad_helper.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // Créé plus loin void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -95,7 +99,11 @@ class _AddProfileState extends State with ShowAlertDialog { if ((password.isNotEmpty) && (confirmedPassword.isNotEmpty)) { if (password != confirmedPassword) { - showAlertDialog(context, "Erreur", "Mot de passe different"); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.password_different ?? + "Must write a different password"); return; } } @@ -117,7 +125,10 @@ class _AddProfileState extends State with ShowAlertDialog { })); print(responsePost.statusCode); if (responsePost.statusCode == 200) { - showAlertDialog(context, "Creation", "Votre utilisateur a été créé"); + showAlertDialog( + context, + AppLocalizations.of(context)?.create ?? "Creation", + AppLocalizations.of(context)?.user_create ?? "Your user created"); Navigator.pushReplacement( context, MaterialPageRoute(builder: (_) => LoginDemo())); return; diff --git a/covas_mobile/lib/pages/ListItemMenu.dart b/covas_mobile/lib/pages/ListItemMenu.dart index f20c68c..d518e9a 100644 --- a/covas_mobile/lib/pages/ListItemMenu.dart +++ b/covas_mobile/lib/pages/ListItemMenu.dart @@ -303,7 +303,6 @@ class _MyHomePageState extends State { } } catch (e) { fetchPostsByLocation(); - print("Error getting city and country: $e"); } } -- 2.49.1 From 1208982b15c90fa931aca20bdf774433fb2d9bb1 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Mon, 14 Jul 2025 23:20:22 +0200 Subject: [PATCH 08/38] full translate for AddProfile pages 15% --- covas_mobile/lib/l10n/app_en.arb | 4 +++- covas_mobile/lib/l10n/app_fr.arb | 4 +++- covas_mobile/lib/pages/AddProfile.dart | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index aff4ba0..b78e654 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -24,5 +24,7 @@ "error":"Error", "password_different":"Must write a different password", "create": "Creation", -"user_create": "Your user created" +"user_create": "Your user created", +"request_error": "Poorly constructed query", +"incorrect_password": "Incorrect password" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 50b3777..cc89034 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -24,5 +24,7 @@ "error":"Erreur", "password_different":"Tu dois écrire un mot de passe different", "create": "Création", -"user_create": "Votre utilisateur a été créé" +"user_create": "Votre utilisateur a été créé", +"request_error": "Requête mal construite", +"incorrect_password": "Mot de passe incorrect" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/AddProfile.dart b/covas_mobile/lib/pages/AddProfile.dart index df01d9f..36e321e 100644 --- a/covas_mobile/lib/pages/AddProfile.dart +++ b/covas_mobile/lib/pages/AddProfile.dart @@ -135,8 +135,10 @@ class _AddProfileState extends State with ShowAlertDialog { } final errorMessages = { - 400: "Requête mal construite", - 406: "Mot de passe incorrect", + 400: AppLocalizations.of(context)?.request_error ?? + "Poorly constructed query", + 406: AppLocalizations.of(context)?.incorrect_password ?? + "Incorrect password", 404: "Utilisateur inconnu", 403: "Utilisateur désactivé", 410: "Token invalide", -- 2.49.1 From ec8ce404ab8851f16073cf2a03cc9e509225b2ea Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 16 Jul 2025 22:08:08 +0200 Subject: [PATCH 09/38] full translate for AddProfile pages 16% --- covas_mobile/lib/l10n/app_en.arb | 3 ++- covas_mobile/lib/l10n/app_fr.arb | 3 ++- covas_mobile/lib/pages/AddProfile.dart | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index b78e654..2f26705 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -26,5 +26,6 @@ "create": "Creation", "user_create": "Your user created", "request_error": "Poorly constructed query", -"incorrect_password": "Incorrect password" +"incorrect_password": "Incorrect password", +"unknown_user": "Utilisateur inconnu" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index cc89034..8926cd5 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -26,5 +26,6 @@ "create": "Création", "user_create": "Votre utilisateur a été créé", "request_error": "Requête mal construite", -"incorrect_password": "Mot de passe incorrect" +"incorrect_password": "Mot de passe incorrect", +"unknown_user": "Utilisateur inconnu" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/AddProfile.dart b/covas_mobile/lib/pages/AddProfile.dart index 36e321e..ce0fc25 100644 --- a/covas_mobile/lib/pages/AddProfile.dart +++ b/covas_mobile/lib/pages/AddProfile.dart @@ -139,7 +139,7 @@ class _AddProfileState extends State with ShowAlertDialog { "Poorly constructed query", 406: AppLocalizations.of(context)?.incorrect_password ?? "Incorrect password", - 404: "Utilisateur inconnu", + 404: AppLocalizations.of(context)?.unknown_user ?? "Utilisateur inconnu", 403: "Utilisateur désactivé", 410: "Token invalide", 500: "Problème interne du serveur", -- 2.49.1 From c3b8b0df146357077202b85752e0db185a97512e Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 16 Jul 2025 22:46:41 +0200 Subject: [PATCH 10/38] full translate for AddProfile pages 20% --- covas_mobile/lib/l10n/app_en.arb | 7 ++++++- covas_mobile/lib/l10n/app_fr.arb | 7 ++++++- covas_mobile/lib/pages/AddProfile.dart | 15 +++++++++------ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 2f26705..813be8c 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -27,5 +27,10 @@ "user_create": "Your user created", "request_error": "Poorly constructed query", "incorrect_password": "Incorrect password", -"unknown_user": "Utilisateur inconnu" +"unknown_user": "Unknown user", +"disabled_user": "User disabled", +"invalid_token": "Invalid token", +"internal_error_server": "Internal error server", +"unknown_error_auth": "Unknown error authentification" + } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 8926cd5..19e1445 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -27,5 +27,10 @@ "user_create": "Votre utilisateur a été créé", "request_error": "Requête mal construite", "incorrect_password": "Mot de passe incorrect", -"unknown_user": "Utilisateur inconnu" +"unknown_user": "Utilisateur inconnu", +"disabled_user": "Utilisateur désactivé", +"invalid_token": "Token invalide", +"internal_error_server": "Erreur interne de serveur", +"unknown_error_auth": "Problème d'authentification inconnu" + } \ No newline at end of file diff --git a/covas_mobile/lib/pages/AddProfile.dart b/covas_mobile/lib/pages/AddProfile.dart index ce0fc25..11de4ea 100644 --- a/covas_mobile/lib/pages/AddProfile.dart +++ b/covas_mobile/lib/pages/AddProfile.dart @@ -139,15 +139,18 @@ class _AddProfileState extends State with ShowAlertDialog { "Poorly constructed query", 406: AppLocalizations.of(context)?.incorrect_password ?? "Incorrect password", - 404: AppLocalizations.of(context)?.unknown_user ?? "Utilisateur inconnu", - 403: "Utilisateur désactivé", - 410: "Token invalide", - 500: "Problème interne du serveur", + 404: AppLocalizations.of(context)?.unknown_user ?? "Unknown user", + 403: AppLocalizations.of(context)?.disabled_user ?? "Disabled user", + 410: AppLocalizations.of(context)?.invalid_token ?? "Invalid token", + 500: AppLocalizations.of(context)?.internal_error_server ?? + "Internal error server" }; final text = errorMessages[responsePost.statusCode] ?? - "Problème d'authentification inconnu"; - showAlertDialog(context, "Erreur serveur", text); + AppLocalizations.of(context)?.unknown_error_auth ?? + "Unknown error auth"; + showAlertDialog( + context, AppLocalizations.of(context)?.error ?? "Error", text); } @override -- 2.49.1 From 1f8d18343c769e3a9f9a8c704f195b8ac60ced74 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 16 Jul 2025 22:58:01 +0200 Subject: [PATCH 11/38] full translate for AddProfile pages 25% --- covas_mobile/lib/l10n/app_en.arb | 5 +++-- covas_mobile/lib/l10n/app_fr.arb | 4 +++- covas_mobile/lib/pages/AddProfile.dart | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 813be8c..a5ce11d 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -31,6 +31,7 @@ "disabled_user": "User disabled", "invalid_token": "Invalid token", "internal_error_server": "Internal error server", -"unknown_error_auth": "Unknown error authentification" - +"unknown_error_auth": "Unknown error authentification", +"required_input": "Required input", +"create_profile": "Create profile" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 19e1445..029489d 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -31,6 +31,8 @@ "disabled_user": "Utilisateur désactivé", "invalid_token": "Token invalide", "internal_error_server": "Erreur interne de serveur", -"unknown_error_auth": "Problème d'authentification inconnu" +"unknown_error_auth": "Problème d'authentification inconnu", +"required_input": "Champ requis", +"create_profile": "Creation profil" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/AddProfile.dart b/covas_mobile/lib/pages/AddProfile.dart index 11de4ea..324d1cb 100644 --- a/covas_mobile/lib/pages/AddProfile.dart +++ b/covas_mobile/lib/pages/AddProfile.dart @@ -166,7 +166,9 @@ class _AddProfileState extends State with ShowAlertDialog { final _formKey = GlobalKey(); String? _validateField(String? value) { - return value!.isEmpty ? 'Champ requis' : null; + return value!.isEmpty + ? AppLocalizations.of(context)?.required_input ?? 'Required input' + : null; } @override @@ -174,7 +176,8 @@ class _AddProfileState extends State with ShowAlertDialog { return Scaffold( backgroundColor: Colors.white, appBar: AppBar( - title: Text("Create profile"), + title: Text( + AppLocalizations.of(context)?.create_profile ?? "Create profile"), backgroundColor: Colors.blue, foregroundColor: Colors.white, ), -- 2.49.1 From c5985f2954b703c474e328f3a870d38216640eaa Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 16 Jul 2025 23:05:49 +0200 Subject: [PATCH 12/38] full translate for AddProfile pages 26% --- covas_mobile/lib/l10n/app_en.arb | 4 +++- covas_mobile/lib/l10n/app_fr.arb | 3 ++- covas_mobile/lib/pages/AddProfile.dart | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index a5ce11d..2128e8a 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -33,5 +33,7 @@ "internal_error_server": "Internal error server", "unknown_error_auth": "Unknown error authentification", "required_input": "Required input", -"create_profile": "Create profile" +"create_profile": "Create profile", +"edit_pseudo": "Edit pseudo" + } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 029489d..f7b9208 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -33,6 +33,7 @@ "internal_error_server": "Erreur interne de serveur", "unknown_error_auth": "Problème d'authentification inconnu", "required_input": "Champ requis", -"create_profile": "Creation profil" +"create_profile": "Creation profil", +"edit_pseudo": "Modifier le pseudo" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/AddProfile.dart b/covas_mobile/lib/pages/AddProfile.dart index 324d1cb..fd111d1 100644 --- a/covas_mobile/lib/pages/AddProfile.dart +++ b/covas_mobile/lib/pages/AddProfile.dart @@ -202,7 +202,8 @@ class _AddProfileState extends State with ShowAlertDialog { decoration: InputDecoration( border: OutlineInputBorder(), labelText: 'Pseudo', - hintText: 'Modifier le pseudo'), + hintText: AppLocalizations.of(context)?.edit_pseudo ?? + 'Edit pseudo'), ), ), Padding( -- 2.49.1 From f81a8c264cef445114087713d31bfbffae4c5738 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 16 Jul 2025 23:32:35 +0200 Subject: [PATCH 13/38] full translate for AddProfile pages 28% --- covas_mobile/lib/l10n/app_en.arb | 5 ++++- covas_mobile/lib/l10n/app_fr.arb | 4 +++- covas_mobile/lib/pages/AddProfile.dart | 18 +++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 2128e8a..3298cb3 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -34,6 +34,9 @@ "unknown_error_auth": "Unknown error authentification", "required_input": "Required input", "create_profile": "Create profile", -"edit_pseudo": "Edit pseudo" +"edit_pseudo": "Edit pseudo", +"password":"Password", +"enter_password": "Enter the passord", + "password_confirmed": "Password confirmed" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index f7b9208..b379001 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -34,6 +34,8 @@ "unknown_error_auth": "Problème d'authentification inconnu", "required_input": "Champ requis", "create_profile": "Creation profil", -"edit_pseudo": "Modifier le pseudo" +"edit_pseudo": "Modifier le pseudo", +"password":"Mot de passe", +"enter_password": "Entrez le password" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/AddProfile.dart b/covas_mobile/lib/pages/AddProfile.dart index fd111d1..309f8a4 100644 --- a/covas_mobile/lib/pages/AddProfile.dart +++ b/covas_mobile/lib/pages/AddProfile.dart @@ -216,8 +216,11 @@ class _AddProfileState extends State with ShowAlertDialog { obscureText: true, decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Mot de passe', - hintText: 'Entrez le mot de passe'), + labelText: AppLocalizations.of(context)?.password ?? + 'Password', + hintText: + AppLocalizations.of(context)?.enter_password ?? + 'Enter the password'), ), ), Padding( @@ -229,9 +232,14 @@ class _AddProfileState extends State with ShowAlertDialog { validator: (value) => _validateField(value), obscureText: true, decoration: InputDecoration( - border: OutlineInputBorder(), - labelText: 'Confirmez le mot de passe', - hintText: 'Confirmez le mot de passe'), + border: OutlineInputBorder(), + labelText: + AppLocalizations.of(context)?.password_confirmed ?? + 'Password confirmed', + hintText: + AppLocalizations.of(context)?.password_confirmed ?? + 'Password confirmed', + ), ), ), Padding( -- 2.49.1 From 26372368b28bda8264684f0cd6c216b13c6f7b64 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Thu, 17 Jul 2025 20:53:07 +0200 Subject: [PATCH 14/38] full translate for AddProfile pages 100% --- covas_mobile/lib/l10n/app_en.arb | 12 ++++++++++- covas_mobile/lib/l10n/app_fr.arb | 12 ++++++++++- covas_mobile/lib/pages/AddProfile.dart | 29 ++++++++++++++++++-------- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 3298cb3..2479b84 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -37,6 +37,16 @@ "edit_pseudo": "Edit pseudo", "password":"Password", "enter_password": "Enter the passord", - "password_confirmed": "Password confirmed" + "password_confirmed": "Password confirmed", + "last_name": "Last name", +"first_name": "First name", +"email": "Mail", +"edit_last_name": "Edit name", +"edit_first_name": "Edit first name", +"edit_email": "Edit email address", +"birth_date": "Birth date", +"edit_birth": "Edit birth date", +"create_profile_button": "Create profile" + } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index b379001..859597e 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -36,6 +36,16 @@ "create_profile": "Creation profil", "edit_pseudo": "Modifier le pseudo", "password":"Mot de passe", -"enter_password": "Entrez le password" +"enter_password": "Entrez le password", +"password_confirmed": "Confirmez le mot de passe", +"last_name": "Nom", +"first_name": "Prénom", +"email": "Email", +"edit_last_name": "Modifier le nom", +"edit_first_name": "Modifier le prénom", +"edit_email": "Modifier l'email", +"birth_date": "Date de naissance", +"edit_birth": "Modifier la date de naissance", +"create_profile_button": "Créer le profil" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/AddProfile.dart b/covas_mobile/lib/pages/AddProfile.dart index 309f8a4..5888f57 100644 --- a/covas_mobile/lib/pages/AddProfile.dart +++ b/covas_mobile/lib/pages/AddProfile.dart @@ -251,8 +251,11 @@ class _AddProfileState extends State with ShowAlertDialog { validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Nom', - hintText: 'Modifier le nom'), + labelText: AppLocalizations.of(context)?.last_name ?? + 'Last name', + hintText: + AppLocalizations.of(context)?.edit_last_name ?? + 'Edit last name'), ), ), Padding( @@ -264,8 +267,11 @@ class _AddProfileState extends State with ShowAlertDialog { validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Prénom', - hintText: 'Modifier le prénom'), + labelText: AppLocalizations.of(context)?.first_name ?? + 'First name', + hintText: + AppLocalizations.of(context)?.edit_first_name ?? + 'Edit first name'), ), ), Padding( @@ -277,8 +283,10 @@ class _AddProfileState extends State with ShowAlertDialog { validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Email', - hintText: 'Modifier l\'adresse mail'), + labelText: + AppLocalizations.of(context)?.email ?? 'Email', + hintText: AppLocalizations.of(context)?.edit_email ?? + 'Edit email'), ), ), Padding( @@ -291,8 +299,10 @@ class _AddProfileState extends State with ShowAlertDialog { validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Date de naissance', - hintText: 'Cliquez ici pour selectionner une date'), + labelText: AppLocalizations.of(context)?.birth_date ?? + 'Birth date', + hintText: AppLocalizations.of(context)?.edit_birth ?? + 'Edit birth date'), onTap: () => onTapFunctionDatePicker(context: context)), ), SizedBox( @@ -311,7 +321,8 @@ class _AddProfileState extends State with ShowAlertDialog { } }, child: Text( - 'Créer le profil', + AppLocalizations.of(context)?.create_profile_button ?? + "Create profile", style: TextStyle(color: Colors.white, fontSize: 25), ), ), -- 2.49.1 From 413807f039d3409b1b0175df1dbe0f49e74c386a Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Fri, 18 Jul 2025 19:06:38 +0200 Subject: [PATCH 15/38] Add camera dart --- covas_mobile/lib/l10n/app_en.arb | 4 ++-- covas_mobile/lib/l10n/app_fr.arb | 4 ++-- covas_mobile/lib/pages/Camera.dart | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 2479b84..b85d511 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -46,7 +46,7 @@ "edit_email": "Edit email address", "birth_date": "Birth date", "edit_birth": "Edit birth date", -"create_profile_button": "Create profile" - +"create_profile_button": "Create profile", +"take_picture": "Take a picture" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 859597e..2a623cd 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -46,6 +46,6 @@ "edit_email": "Modifier l'email", "birth_date": "Date de naissance", "edit_birth": "Modifier la date de naissance", -"create_profile_button": "Créer le profil" - +"create_profile_button": "Créer le profil", +"take_picture": "Take a picture" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/Camera.dart b/covas_mobile/lib/pages/Camera.dart index 6c79f94..0189dc0 100644 --- a/covas_mobile/lib/pages/Camera.dart +++ b/covas_mobile/lib/pages/Camera.dart @@ -7,6 +7,10 @@ import 'DisplayPictureScreen.dart'; import 'package:camera/camera.dart'; import 'package:flutter/material.dart'; import '../classes/auth_service.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // Créé plus loin Future main() async { // Ensure that plugin services are initialized so that `availableCameras()` @@ -92,7 +96,9 @@ class CameraState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: const Text('Take a picture')), + appBar: AppBar( + title: Text(AppLocalizations.of(context)?.take_picture ?? + "Take a picture")), // You must wait until the controller is initialized before displaying the // camera preview. Use a FutureBuilder to display a loading spinner until the // controller has finished initializing. -- 2.49.1 From 79563e829c94d7e1d1da482e4d309311fb2c5e8f Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Fri, 18 Jul 2025 19:38:10 +0200 Subject: [PATCH 16/38] Add displaypicture --- covas_mobile/lib/l10n/app_en.arb | 9 +++++- covas_mobile/lib/l10n/app_fr.arb | 8 ++++- covas_mobile/lib/pages/CameraEdit.dart | 8 ++++- .../lib/pages/DisplayPictureScreen.dart | 32 +++++++++++++++---- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index b85d511..80bc49c 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -47,6 +47,13 @@ "birth_date": "Birth date", "edit_birth": "Edit birth date", "create_profile_button": "Create profile", -"take_picture": "Take a picture" +"take_picture": "Take a picture", +"error_ia": "Google AI failed to analyze picture. Retry with another one", +"no_data_geo": "No geographical data", +"response_status_update": "response status code update", +"error_token": "Token error", +"error_format": "Data format error given by AI" + + } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 2a623cd..f220697 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -47,5 +47,11 @@ "birth_date": "Date de naissance", "edit_birth": "Modifier la date de naissance", "create_profile_button": "Créer le profil", -"take_picture": "Take a picture" +"take_picture": "Take a picture", +"error_ia": "L'IA de Google n'a pas su analyser l'image. Recommencer avec une autre", +"no_data_geo": "Aucune donnée géographique", +"response_status_update": "Code du statut de réponse de la modification", +"error_token": "Erreur de token", +"error_format": "Erreur de format de donnée fourni par l'IA" + } \ No newline at end of file diff --git a/covas_mobile/lib/pages/CameraEdit.dart b/covas_mobile/lib/pages/CameraEdit.dart index 09034ce..408e8fc 100644 --- a/covas_mobile/lib/pages/CameraEdit.dart +++ b/covas_mobile/lib/pages/CameraEdit.dart @@ -8,6 +8,10 @@ import 'EditEvent.dart'; import 'package:camera/camera.dart'; import 'package:flutter/material.dart'; import '../classes/auth_service.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // Créé Future main() async { // Ensure that plugin services are initialized so that `availableCameras()` @@ -94,7 +98,9 @@ class CameraEditState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: const Text('Take a picture')), + appBar: AppBar( + title: Text(AppLocalizations.of(context)?.take_picture ?? + 'Take a picture')), // You must wait until the controller is initialized before displaying the // camera preview. Use a FutureBuilder to display a loading spinner until the // controller has finished initializing. diff --git a/covas_mobile/lib/pages/DisplayPictureScreen.dart b/covas_mobile/lib/pages/DisplayPictureScreen.dart index 5d0ee55..a7d7763 100644 --- a/covas_mobile/lib/pages/DisplayPictureScreen.dart +++ b/covas_mobile/lib/pages/DisplayPictureScreen.dart @@ -17,6 +17,10 @@ import '../classes/MyDrawer.dart'; import '../classes/ad_helper.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import '../classes/auth_service.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // Créé void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -98,8 +102,11 @@ class DisplayPictureScreenState extends State Future displayError(String e) async { print("problem gemini : ${e}"); - showAlertDialog(context, 'Error IA', - "L'IA de Google n'a pas su analyser l'image. Recommecer avec une autre"); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? 'Error', + AppLocalizations.of(context)?.error_ia ?? + 'Google AI failed to analyze picture. Retry with another one'); } void _showErrorDialog(BuildContext context, String title, String message) { @@ -154,7 +161,10 @@ class DisplayPictureScreenState extends State final location = await _fetchGeolocation(place); if (location == null) { _showErrorDialog( - context, "Erreur serveur", "Aucune donnée geographique"); + context, + AppLocalizations.of(context)?.error ?? 'Error', + AppLocalizations.of(context)?.no_data_geo ?? + 'No geographical data'); return; } @@ -181,15 +191,23 @@ class DisplayPictureScreenState extends State builder: (_) => ItemMenu(title: events[0]["id"]))); } } else { - showAlertDialog(context, 'Erreur de reponse', - "response status code update : ${response.statusCode}"); + String error = AppLocalizations.of(context)?.response_status_update ?? + 'Response status update : ${response.statusCode}'; + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? 'Error', + "${error} : ${response.statusCode}"); } } else { - showAlertDialog(context, "Erreur de reponse", "Erreur de token"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? 'Error', + AppLocalizations.of(context)?.error_token ?? "Token error"); } } catch (e) { showAlertDialog( - context, "Erreur IA", "Erreur de format de donnée fourni par l'IA"); + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.error_format ?? + "Data format error given by AI"); } //showDescImageAddDialog(context, message); -- 2.49.1 From b4dc29aff6b06de07bad99f498ac12afacf58946 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Mon, 21 Jul 2025 22:50:56 +0200 Subject: [PATCH 17/38] translate displaypicturescreen 100% --- covas_mobile/lib/l10n/app_en.arb | 8 ++++---- covas_mobile/lib/l10n/app_fr.arb | 5 ++++- covas_mobile/lib/pages/DisplayPictureScreen.dart | 11 ++++++++--- covas_mobile/lib/pages/EditEvent.dart | 4 ++++ 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 80bc49c..04f7294 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -52,8 +52,8 @@ "no_data_geo": "No geographical data", "response_status_update": "response status code update", "error_token": "Token error", -"error_format": "Data format error given by AI" - - - +"error_format": "Data format error given by AI", +"display_picture": "Display the Picture", +"analyze_image": "Image Analyze in progress", +"loading_progress": "Loading progress" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index f220697..228edb4 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -52,6 +52,9 @@ "no_data_geo": "Aucune donnée géographique", "response_status_update": "Code du statut de réponse de la modification", "error_token": "Erreur de token", -"error_format": "Erreur de format de donnée fourni par l'IA" +"error_format": "Erreur de format de donnée fourni par l'IA", +"display_picture": "Display the Picture", +"analyze_image": "Analyse de l'image en cours", +"loading_progress": "Chargement en cours" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/DisplayPictureScreen.dart b/covas_mobile/lib/pages/DisplayPictureScreen.dart index a7d7763..aea3380 100644 --- a/covas_mobile/lib/pages/DisplayPictureScreen.dart +++ b/covas_mobile/lib/pages/DisplayPictureScreen.dart @@ -235,7 +235,9 @@ class DisplayPictureScreenState extends State @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: const Text('Display the Picture')), + appBar: AppBar( + title: Text(AppLocalizations.of(context)?.display_picture ?? + "Display The Picture")), // The image is stored as a file on the device. Use the `Image.file` // constructor with the given path to display the image. drawer: MyDrawer(), @@ -251,12 +253,15 @@ class DisplayPictureScreenState extends State width: _bannerAd!.size.width.toDouble(), child: AdWidget(ad: _bannerAd!)), Text( - 'Analyse de l\'image en cours', + AppLocalizations.of(context)?.analyze_image ?? + 'Image analyze in progress', style: Theme.of(context).textTheme.titleLarge, ), CircularProgressIndicator( value: controller.value, - semanticsLabel: 'Loading progress', + semanticsLabel: + AppLocalizations.of(context)?.loading_progress ?? + 'Loading progress', ), ]))); } diff --git a/covas_mobile/lib/pages/EditEvent.dart b/covas_mobile/lib/pages/EditEvent.dart index 00900f1..6b9494b 100644 --- a/covas_mobile/lib/pages/EditEvent.dart +++ b/covas_mobile/lib/pages/EditEvent.dart @@ -22,6 +22,10 @@ import '../variable/globals.dart' as globals; import '../classes/ad_helper.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import '../classes/auth_service.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // Créé void main() async { WidgetsFlutterBinding.ensureInitialized(); -- 2.49.1 From 1df36987d94d44a683e5cd930d9fb78508f91d0f Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 23 Jul 2025 23:18:52 +0200 Subject: [PATCH 18/38] translate editevent 50% --- covas_mobile/lib/l10n/app_en.arb | 13 ++++- covas_mobile/lib/l10n/app_fr.arb | 13 ++++- covas_mobile/lib/pages/EditEvent.dart | 68 +++++++++++++++++++-------- 3 files changed, 72 insertions(+), 22 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 04f7294..1f2224d 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -55,5 +55,16 @@ "error_format": "Data format error given by AI", "display_picture": "Display the Picture", "analyze_image": "Image Analyze in progress", -"loading_progress": "Loading progress" +"loading_progress": "Loading progress", +"error_event": "Event error", +"no_future_event": "No future event", +"error_user": "Error user", +"empty_input": "Empty input", +"info_event": "Event info", +"event_already": "Event already exists", +"picture_error": "Picture error", +"no_picture_published": "No picture published", +"event_update": "Event updated", +"location": "Location", +"add_event": "Add or Update a event" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 228edb4..9074e35 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -55,6 +55,17 @@ "error_format": "Erreur de format de donnée fourni par l'IA", "display_picture": "Display the Picture", "analyze_image": "Analyse de l'image en cours", -"loading_progress": "Chargement en cours" +"loading_progress": "Chargement en cours", +"error_event": "Erreur de l'évènement", +"no_future_event": "Évènement non futur", +"error_user": "Erreur de l'utilisateur", +"empty_input": "Champ vide", +"info_event": "Event info", +"event_already": "Event already exists", +"picture_error": "Erreur image", +"no_picture_published": "Image non publiée", +"event_update": "Évènement modifié", +"location": "Lieu", +"add_event": "Ajouter ou modifier un évènement" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/EditEvent.dart b/covas_mobile/lib/pages/EditEvent.dart index 6b9494b..578b50c 100644 --- a/covas_mobile/lib/pages/EditEvent.dart +++ b/covas_mobile/lib/pages/EditEvent.dart @@ -170,13 +170,19 @@ class _EditEventState extends State Future _updateEvent(BuildContext context) async { if (!_isEventInFuture()) { - _showErrorDialog(context, "Erreur evenement", "Evenement non futur"); + _showErrorDialog( + context, + AppLocalizations.of(context)?.error_event ?? "Event error", + AppLocalizations.of(context)?.no_future_event ?? "No future event"); return; } final accessToken = await _getAccessToken(); if (accessToken.isEmpty) { - _showErrorDialog(context, "Erreur utilisateur", "Champ vide"); + _showErrorDialog( + context, + AppLocalizations.of(context)?.error_user ?? "User error", + AppLocalizations.of(context)?.empty_input ?? "Empty input"); return; } @@ -185,27 +191,41 @@ class _EditEventState extends State final geolocation = await _fetchGeolocation(); if (geolocation == null) { _showErrorDialog( - context, "Erreur serveur", "Aucune donnée geographique"); + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.no_data_geo ?? + "No geographical data"); return; } if (await _isDuplicateEvent(accessToken, geolocation)) { - _showErrorDialog(context, "Info evenement", "Evenement deja existant"); + _showErrorDialog( + context, + AppLocalizations.of(context)?.info_event ?? "Event info", + AppLocalizations.of(context)?.event_already ?? + "Event already exists"); return; } if (widget.imgPath.isNotEmpty) { imgUrl = await _uploadImage(widget.imgPath); if (imgUrl.isEmpty) { - _showErrorDialog(context, "Erreur image", "Image non postée"); + _showErrorDialog( + context, + AppLocalizations.of(context)?.picture_error ?? "Error picture", + AppLocalizations.of(context)?.no_picture_published ?? + "No picture published"); return; } } await _updateEventData(accessToken, geolocation); - showEventDialog(context, "Evenement ${inputName.text} modifie"); + String message = + AppLocalizations.of(context)?.event_update ?? "Event updated"; + showEventDialog(context, "${message} : ${inputName.text}"); } catch (e) { - _showErrorDialog(context, "Erreur serveur", "$e"); + _showErrorDialog( + context, AppLocalizations.of(context)?.error ?? "Error", "$e"); } } @@ -301,15 +321,22 @@ class _EditEventState extends State void _handleErrorResponse(BuildContext context, int statusCode) { final messages = { - 400: "Requête mal construite", - 406: "Mot de passe incorrect", - 404: "Utilisateur inconnu", - 403: "Utilisateur désactivé", - 410: "Token invalide", - 500: "Problème interne du serveur" + 400: AppLocalizations.of(context)?.request_error ?? + "Poorly constructed query", + 406: AppLocalizations.of(context)?.incorrect_password ?? + "Incorrect password", + 404: AppLocalizations.of(context)?.unknown_user ?? "Unknown user", + 403: AppLocalizations.of(context)?.disabled_user ?? "Disabled user", + 410: AppLocalizations.of(context)?.invalid_token ?? "Invalid token", + 500: AppLocalizations.of(context)?.internal_error_server ?? + "Internal error server" }; - _showErrorDialog(context, "Erreur serveur", - messages[statusCode] ?? "Problème d'authentification inconnu"); + _showErrorDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + messages[statusCode] ?? + AppLocalizations.of(context)?.unknown_error_auth ?? + "Unknown error auth"); } void _showErrorDialog(BuildContext context, String title, String message) { @@ -353,7 +380,9 @@ class _EditEventState extends State final _formKey = GlobalKey(); String? _validateField(String? value) { - return value!.isEmpty ? 'Champ requis' : null; + return value!.isEmpty + ? AppLocalizations.of(context)?.required_input ?? "Required input" + : null; } Future searchSuggestions(String input) async { @@ -364,11 +393,9 @@ class _EditEventState extends State 'https://api.mapbox.com/geocoding/v5/mapbox.places/${input}.json?access_token=${mapboxAccessToken}&types=poi,address,place'; var encoded = Uri.encodeFull(url); final response = await http.get(Uri.parse(encoded)); - print("response code suggesttion : ${response.statusCode}"); if (response.statusCode == 200) { final data = json.decode(response.body); - print("data suggestion : ${data}"); setState(() { suggestions = (data['features'] as List) .map((feature) => { @@ -393,7 +420,7 @@ class _EditEventState extends State TextField( controller: inputGeo, decoration: InputDecoration( - labelText: 'Lieu', + labelText: AppLocalizations.of(context)?.location ?? "Location", border: OutlineInputBorder(), suffixIcon: IconButton( icon: const Icon(Icons.clear), @@ -463,7 +490,8 @@ class _EditEventState extends State backgroundColor: Colors.white, drawer: MyDrawer(), appBar: AppBar( - title: Text("Add or Update a event"), + title: Text(AppLocalizations.of(context)?.add_event ?? + "Add or Update a event"), backgroundColor: Colors.blue, foregroundColor: Colors.white, ), -- 2.49.1 From f8b5c24efd68f459748d0f677dc38ae87a1c6f81 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 23 Jul 2025 23:28:16 +0200 Subject: [PATCH 19/38] translate editevent 55% --- covas_mobile/lib/l10n/app_en.arb | 3 ++- covas_mobile/lib/l10n/app_fr.arb | 4 ++-- covas_mobile/lib/pages/EditEvent.dart | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 1f2224d..7776bf1 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -66,5 +66,6 @@ "no_picture_published": "No picture published", "event_update": "Event updated", "location": "Location", -"add_event": "Add or Update a event" +"add_event": "Add or Update a event", +"edit_image": "Edit pictures" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 9074e35..2bfe4b6 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -66,6 +66,6 @@ "no_picture_published": "Image non publiée", "event_update": "Évènement modifié", "location": "Lieu", -"add_event": "Ajouter ou modifier un évènement" - +"add_event": "Ajouter ou modifier un évènement", +"edit_image": "Changer la photo" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/EditEvent.dart b/covas_mobile/lib/pages/EditEvent.dart index 578b50c..e8aef4a 100644 --- a/covas_mobile/lib/pages/EditEvent.dart +++ b/covas_mobile/lib/pages/EditEvent.dart @@ -548,7 +548,8 @@ class _EditEventState extends State child: ElevatedButton.icon( onPressed: popCamera, icon: Icon(Icons.edit, size: 16), // Edit icon - label: Text("Edit Image"), // Button text + label: Text(AppLocalizations.of(context)?.edit_image ?? + "Edit pictures"), // Button text style: ElevatedButton.styleFrom( backgroundColor: Colors.blue, // Button color foregroundColor: Colors.white, // Text color -- 2.49.1 From 271c3ba1183dcf5c77aee7214b7c0f63c4363e02 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Thu, 24 Jul 2025 20:25:52 +0200 Subject: [PATCH 20/38] translate editevent 75% --- covas_mobile/lib/l10n/app_en.arb | 8 ++++++- covas_mobile/lib/l10n/app_fr.arb | 9 +++++++- covas_mobile/lib/pages/EditEvent.dart | 30 ++++++++++++++++++--------- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 7776bf1..a23ad39 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -67,5 +67,11 @@ "event_update": "Event updated", "location": "Location", "add_event": "Add or Update a event", -"edit_image": "Edit pictures" +"edit_image": "Edit pictures", +"name": "Name", +"edit_event_name": "Edit event name", +"start_time": "Start time", +"end_time": "End time", +"select_date": "Click to select a date", +"select_time": "Click to select a time" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 2bfe4b6..a6f3083 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -67,5 +67,12 @@ "event_update": "Évènement modifié", "location": "Lieu", "add_event": "Ajouter ou modifier un évènement", -"edit_image": "Changer la photo" +"edit_image": "Changer la photo", +"name": "Nom", +"edit_event_name": "Changer le nom de l'évènement", +"start_time": "Heure de début", +"end_time": "Heure de fin", +"select_date": "Cliquer pour selectionner une date", +"select_time": "Cliquer pour selectionner une heure" + } \ No newline at end of file diff --git a/covas_mobile/lib/pages/EditEvent.dart b/covas_mobile/lib/pages/EditEvent.dart index e8aef4a..4adbb08 100644 --- a/covas_mobile/lib/pages/EditEvent.dart +++ b/covas_mobile/lib/pages/EditEvent.dart @@ -566,8 +566,10 @@ class _EditEventState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Nom', - hintText: 'Modifier le nom de l\'évènement'), + labelText: AppLocalizations.of(context)?.name ?? "Name", + hintText: + AppLocalizations.of(context)?.edit_event_name ?? + "Edit event name"), ), ), _buildGeographicalZoneSearchField(), @@ -581,8 +583,10 @@ class _EditEventState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Date de debut', - hintText: 'Cliquez ici pour selectionner une date'), + labelText: AppLocalizations.of(context)?.start_date ?? + "Start date", + hintText: AppLocalizations.of(context)?.select_date ?? + "Click to select a date"), onTap: () => onTapFunctionDatePicker( context: context, position: "start")), ), @@ -596,8 +600,10 @@ class _EditEventState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Heure de debut', - hintText: 'Cliquez ici pour selectionner une heure'), + labelText: AppLocalizations.of(context)?.start_time ?? + "Start time", + hintText: AppLocalizations.of(context)?.select_time ?? + "Click to select a time"), onTap: () => onTapFunctionTimePicker( context: context, position: "start")), ), @@ -611,8 +617,10 @@ class _EditEventState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Date de fin', - hintText: 'Cliquez ici pour selectionner une date'), + labelText: AppLocalizations.of(context)?.end_date ?? + "End date", + hintText: AppLocalizations.of(context)?.select_time ?? + "Click to select a date"), onTap: () => onTapFunctionDatePicker( context: context, position: "end")), ), @@ -626,8 +634,10 @@ class _EditEventState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Heure de fin', - hintText: 'Cliquez ici pour selectionner une heure'), + labelText: AppLocalizations.of(context)?.end_time ?? + "End time", + hintText: AppLocalizations.of(context)?.select_time ?? + "Click to select a time"), onTap: () => onTapFunctionTimePicker( context: context, position: "end")), ), -- 2.49.1 From f143036ca8e1905b27cdcb26adec76d942e20f2f Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Thu, 24 Jul 2025 20:42:25 +0200 Subject: [PATCH 21/38] translate editevent 100% --- covas_mobile/lib/l10n/app_en.arb | 11 +++++++++- covas_mobile/lib/l10n/app_fr.arb | 11 +++++++++- covas_mobile/lib/pages/EditEvent.dart | 30 +++++++++++++++++++-------- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index a23ad39..84f82bc 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -73,5 +73,14 @@ "start_time": "Start time", "end_time": "End time", "select_date": "Click to select a date", -"select_time": "Click to select a time" +"select_time": "Click to select a time", +"tag": "Tags", +"already_tag": "You have already this tags", +"enter_tag": "Enter a tag", +"organizer": "Organizer", +"already_organiser": "You have already a organizer", +"enter_organizer": "Enter a organizer", +"description": "Description", +"describe_event": "Describe event", +"add": "Add" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index a6f3083..b55a875 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -73,6 +73,15 @@ "start_time": "Heure de début", "end_time": "Heure de fin", "select_date": "Cliquer pour selectionner une date", -"select_time": "Cliquer pour selectionner une heure" +"select_time": "Cliquer pour selectionner une heure", +"tag": "Tags", +"already_tag": "Tu as déjà entré ce tag", +"enter_tag": "Entrer un tag", +"organizer": "Organisateur", +"already_organiser": "Tu as déjà rentré cet organisateur", +"enter_organizer": "Entrer un organisateur", +"description": "Description", +"describe_event": "Décrire l'évènement", +"add": "Ajouter" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/EditEvent.dart b/covas_mobile/lib/pages/EditEvent.dart index 4adbb08..7c885bc 100644 --- a/covas_mobile/lib/pages/EditEvent.dart +++ b/covas_mobile/lib/pages/EditEvent.dart @@ -647,7 +647,8 @@ class _EditEventState extends State textSeparators: const [' ', ','], validator: (String tag) { if (_stringTagController.getTags!.contains(tag)) { - return 'Tu as deja rentre ce tag'; + return AppLocalizations.of(context)?.already_tag ?? + "You have already entered this tag"; } return null; }, @@ -662,10 +663,12 @@ class _EditEventState extends State onSubmitted: inputFieldValues.onTagSubmitted, decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Tags', + labelText: + AppLocalizations.of(context)?.tag ?? 'Tags', hintText: inputFieldValues.tags.isNotEmpty ? '' - : "Enter tag...", + : AppLocalizations.of(context)?.enter_tag ?? + "Enter tag...", errorText: inputFieldValues.error, prefixIcon: inputFieldValues.tags.isNotEmpty ? SingleChildScrollView( @@ -742,7 +745,9 @@ class _EditEventState extends State textSeparators: const [','], validator: (String tag) { if (_stringOrgaController.getTags!.contains(tag)) { - return 'Cet organisateur est déjà rentré'; + return AppLocalizations.of(context) + ?.already_organiser ?? + "You have already entered this organizer"; } return null; }, @@ -757,10 +762,14 @@ class _EditEventState extends State onSubmitted: inputFieldValues.onTagSubmitted, decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Organisateurs', + labelText: + AppLocalizations.of(context)?.organizer ?? + "Organizer", hintText: inputFieldValues.tags.isNotEmpty ? '' - : "Enter un organisateur...", + : AppLocalizations.of(context) + ?.enter_organizer ?? + "Enter a organizer", errorText: inputFieldValues.error, prefixIcon: inputFieldValues.tags.isNotEmpty ? SingleChildScrollView( @@ -841,8 +850,11 @@ class _EditEventState extends State maxLines: 10, decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Description', - hintText: 'Décrire l\'evènement'), + labelText: AppLocalizations.of(context)?.description ?? + 'Description', + hintText: + AppLocalizations.of(context)?.describe_event ?? + 'Describe event'), ), ), SizedBox( @@ -861,7 +873,7 @@ class _EditEventState extends State } }, child: Text( - 'Ajouter', + AppLocalizations.of(context)?.add ?? 'Add', style: TextStyle(color: Colors.white, fontSize: 25), ), ), -- 2.49.1 From 199000035e52d2a23ea44c13da8055d511d5d622 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Thu, 24 Jul 2025 21:04:27 +0200 Subject: [PATCH 22/38] translate editprofile 75% --- covas_mobile/lib/l10n/app_en.arb | 3 +- covas_mobile/lib/l10n/app_fr.arb | 4 +- covas_mobile/lib/pages/EditProfile.dart | 111 +++++++++++++++--------- 3 files changed, 77 insertions(+), 41 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 84f82bc..7a39c51 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -82,5 +82,6 @@ "enter_organizer": "Enter a organizer", "description": "Description", "describe_event": "Describe event", -"add": "Add" +"add": "Add", +"update_profile": "Update profile" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index b55a875..da9ec6d 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -82,6 +82,8 @@ "enter_organizer": "Entrer un organisateur", "description": "Description", "describe_event": "Décrire l'évènement", -"add": "Ajouter" +"add": "Ajouter", +"update_profile": "Modifier le profil" + } \ No newline at end of file diff --git a/covas_mobile/lib/pages/EditProfile.dart b/covas_mobile/lib/pages/EditProfile.dart index c1aaea3..f80be3b 100644 --- a/covas_mobile/lib/pages/EditProfile.dart +++ b/covas_mobile/lib/pages/EditProfile.dart @@ -18,6 +18,10 @@ import '../variable/globals.dart' as globals; import '../classes/ad_helper.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import '../classes/auth_service.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // Créé void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -104,7 +108,8 @@ class _EditProfileState extends State if ((password.isNotEmpty) && (confirmedPassword.isNotEmpty)) { if (password != confirmedPassword) { - showAlertDialog(context, "Erreur", "Mot de passe different"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + "Mot de passe different"); return; } } @@ -137,18 +142,22 @@ class _EditProfileState extends State return; } - final errorMessages = { - 400: "Requête mal construite", - 406: "Mot de passe incorrect", - 404: "Utilisateur inconnu", - 403: "Utilisateur désactivé", - 410: "Token invalide", - 500: "Problème interne du serveur", + final messages = { + 400: AppLocalizations.of(context)?.request_error ?? + "Poorly constructed query", + 406: AppLocalizations.of(context)?.incorrect_password ?? + "Incorrect password", + 404: AppLocalizations.of(context)?.unknown_user ?? "Unknown user", + 403: AppLocalizations.of(context)?.disabled_user ?? "Disabled user", + 410: AppLocalizations.of(context)?.invalid_token ?? "Invalid token", + 500: AppLocalizations.of(context)?.internal_error_server ?? + "Internal error server" }; - - final text = errorMessages[responsePut.statusCode] ?? - "Problème d'authentification inconnu"; - showAlertDialog(context, "Erreur serveur", text); + final text = messages[responsePut.statusCode] ?? + AppLocalizations.of(context)?.unknown_error_auth ?? + "Unknown error auth"; + showAlertDialog( + context, AppLocalizations.of(context)?.error ?? "Error", text); } else { Navigator.pushReplacement( context, MaterialPageRoute(builder: (_) => LoginDemo())); @@ -180,18 +189,22 @@ class _EditProfileState extends State return; } - final errorMessages = { - 400: "Requête mal construite", - 406: "Mot de passe incorrect", - 404: "Utilisateur inconnu", - 403: "Utilisateur désactivé", - 410: "Token invalide", - 500: "Problème interne du serveur", + final messages = { + 400: AppLocalizations.of(context)?.request_error ?? + "Poorly constructed query", + 406: AppLocalizations.of(context)?.incorrect_password ?? + "Incorrect password", + 404: AppLocalizations.of(context)?.unknown_user ?? "Unknown user", + 403: AppLocalizations.of(context)?.disabled_user ?? "Disabled user", + 410: AppLocalizations.of(context)?.invalid_token ?? "Invalid token", + 500: AppLocalizations.of(context)?.internal_error_server ?? + "Internal error server" }; - - final text = errorMessages[responseGet.statusCode] ?? - "Problème d'authentification inconnu"; - showAlertDialog(context, "Erreur serveur", text); + final text = messages[responseGet.statusCode] ?? + AppLocalizations.of(context)?.unknown_error_auth ?? + "Unknown error auth"; + showAlertDialog( + context, AppLocalizations.of(context)?.error ?? "Error", text); } else { Navigator.pushReplacement( context, MaterialPageRoute(builder: (_) => LoginDemo())); @@ -213,7 +226,9 @@ class _EditProfileState extends State final _formKey = GlobalKey(); String? _validateField(String? value) { - return value!.isEmpty ? 'Champ requis' : null; + return value!.isEmpty + ? AppLocalizations.of(context)?.required_input ?? "Required input" + : null; } @override @@ -246,8 +261,9 @@ class _EditProfileState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Pseudo', - hintText: 'Modifier le pseudo'), + labelText: AppLocalizations.of(context)?.name, + hintText: AppLocalizations.of(context)?.edit_pseudo ?? + "Edit pseudo"), ), ), Padding( @@ -259,8 +275,11 @@ class _EditProfileState extends State obscureText: true, decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Mot de passe', - hintText: 'Entrez le mot de passe'), + labelText: AppLocalizations.of(context)?.password ?? + "Password", + hintText: + AppLocalizations.of(context)?.enter_password ?? + "Enter a password"), ), ), Padding( @@ -272,8 +291,12 @@ class _EditProfileState extends State obscureText: true, decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Confirmez le mot de passe', - hintText: 'Confirmez le mot de passe'), + labelText: + AppLocalizations.of(context)?.password_confirmed ?? + "Must confirm password", + hintText: + AppLocalizations.of(context)?.password_confirmed ?? + "Must confirm password"), ), ), Padding( @@ -285,8 +308,11 @@ class _EditProfileState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Nom', - hintText: 'Modifier le nom'), + labelText: AppLocalizations.of(context)?.last_name ?? + "Last name", + hintText: + AppLocalizations.of(context)?.edit_last_name ?? + "Edit last name"), ), ), Padding( @@ -298,8 +324,11 @@ class _EditProfileState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Prénom', - hintText: 'Modifier le prénom'), + labelText: AppLocalizations.of(context)?.first_name ?? + "First name", + hintText: + AppLocalizations.of(context)?.edit_first_name ?? + "Edit first name"), ), ), Padding( @@ -311,8 +340,10 @@ class _EditProfileState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Email', - hintText: 'Modifier l\'adresse mail'), + labelText: + AppLocalizations.of(context)?.email ?? "Email", + hintText: AppLocalizations.of(context)?.edit_email ?? + "Edit email"), ), ), Padding( @@ -325,8 +356,9 @@ class _EditProfileState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Date de naissance', - hintText: 'Cliquez ici pour selectionner une date'), + labelText: AppLocalizations.of(context)?.birth_date, + hintText: AppLocalizations.of(context)?.edit_birth ?? + "Click to select a birth date"), onTap: () => onTapFunctionDatePicker(context: context)), ), SizedBox( @@ -345,7 +377,8 @@ class _EditProfileState extends State } }, child: Text( - 'Modifier le profil', + AppLocalizations.of(context)?.update_profile ?? + "Update profile", style: TextStyle(color: Colors.white, fontSize: 25), ), ), -- 2.49.1 From a99986813e3f00a5dd92c7e608cdd612b3275de6 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Fri, 25 Jul 2025 23:04:28 +0200 Subject: [PATCH 23/38] translate editprofile 100% --- covas_mobile/lib/l10n/app_en.arb | 4 +++- covas_mobile/lib/l10n/app_fr.arb | 4 +++- covas_mobile/lib/pages/EditProfile.dart | 15 ++++++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 7a39c51..b6090d4 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -25,6 +25,7 @@ "password_different":"Must write a different password", "create": "Creation", "user_create": "Your user created", +"user_update": "Your user updated", "request_error": "Poorly constructed query", "incorrect_password": "Incorrect password", "unknown_user": "Unknown user", @@ -83,5 +84,6 @@ "description": "Description", "describe_event": "Describe event", "add": "Add", -"update_profile": "Update profile" +"update_profile": "Update profile", +"different_password_error": "Different password" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index da9ec6d..2b02d0f 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -25,6 +25,7 @@ "password_different":"Tu dois écrire un mot de passe different", "create": "Création", "user_create": "Votre utilisateur a été créé", +"user_update": "Votre utilisateur a été modifié", "request_error": "Requête mal construite", "incorrect_password": "Mot de passe incorrect", "unknown_user": "Utilisateur inconnu", @@ -83,7 +84,8 @@ "description": "Description", "describe_event": "Décrire l'évènement", "add": "Ajouter", -"update_profile": "Modifier le profil" +"update_profile": "Modifier le profil", +"different_password_error": "Mot de passe différent" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/EditProfile.dart b/covas_mobile/lib/pages/EditProfile.dart index f80be3b..ff62847 100644 --- a/covas_mobile/lib/pages/EditProfile.dart +++ b/covas_mobile/lib/pages/EditProfile.dart @@ -108,8 +108,11 @@ class _EditProfileState extends State if ((password.isNotEmpty) && (confirmedPassword.isNotEmpty)) { if (password != confirmedPassword) { - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Mot de passe different"); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.different_password_error ?? + "Different password"); return; } } @@ -136,7 +139,8 @@ class _EditProfileState extends State })); print(responsePut.statusCode); if (responsePut.statusCode == 200) { - showEventDialog(context, "Votre utilisateur a été modifié"); + showEventDialog(context, + AppLocalizations.of(context)?.user_update ?? "Your user updated"); Navigator.pushReplacement( context, MaterialPageRoute(builder: (_) => EditProfile())); return; @@ -236,7 +240,8 @@ class _EditProfileState extends State return Scaffold( backgroundColor: Colors.white, appBar: AppBar( - title: Text("Update profile"), + title: Text( + AppLocalizations.of(context)?.update_profile ?? "Update profile"), backgroundColor: Colors.blue, foregroundColor: Colors.white, ), @@ -378,7 +383,7 @@ class _EditProfileState extends State }, child: Text( AppLocalizations.of(context)?.update_profile ?? - "Update profile", + "Update profile ", style: TextStyle(color: Colors.white, fontSize: 25), ), ), -- 2.49.1 From 337fab4a08d2dcffbf26756e719eae7f98b695fb Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Fri, 25 Jul 2025 23:20:51 +0200 Subject: [PATCH 24/38] translate editsettings 100% --- covas_mobile/lib/l10n/app_en.arb | 7 ++++++- covas_mobile/lib/l10n/app_fr.arb | 8 ++++++-- covas_mobile/lib/pages/EditSettings.dart | 18 ++++++++++++++---- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index b6090d4..e929000 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -85,5 +85,10 @@ "describe_event": "Describe event", "add": "Add", "update_profile": "Update profile", -"different_password_error": "Different password" +"different_password_error": "Different password", +"update": "Update", +"updated": "Updated", +"settings_updated": "Settings updated", +"define_kilometer": "Define Kilometer", +"settings": "Settings" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 2b02d0f..f5133bc 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -85,7 +85,11 @@ "describe_event": "Décrire l'évènement", "add": "Ajouter", "update_profile": "Modifier le profil", -"different_password_error": "Mot de passe différent" - +"different_password_error": "Mot de passe différent", +"update": "Mettre à jour", +"updated": "Mis à jour", +"settings_updated": "Paramètre mis à jour", +"define_kilometer": "Definir un kilomètre", +"settings": "Paramètres" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/EditSettings.dart b/covas_mobile/lib/pages/EditSettings.dart index 0be4c14..c6e36f9 100644 --- a/covas_mobile/lib/pages/EditSettings.dart +++ b/covas_mobile/lib/pages/EditSettings.dart @@ -14,6 +14,11 @@ import '../classes/ad_helper.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import '../classes/auth_service.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // Créé + void main() async { WidgetsFlutterBinding.ensureInitialized(); await MobileAds.instance.initialize(); @@ -56,7 +61,10 @@ class _EditProfileState extends State SharedPreferences prefs = await SharedPreferences.getInstance(); if (kilometer != null) { prefs.setDouble("kilometer", kilometer?.toDouble() ?? 50); - showAlertDialog(context, "Update", "Mise à jour des paramètres"); + showAlertDialog( + context, + AppLocalizations.of(context)?.updated ?? "Updated", + AppLocalizations.of(context)?.settings_updated ?? "Settings updated"); } } @@ -78,7 +86,7 @@ class _EditProfileState extends State return Scaffold( backgroundColor: Colors.white, appBar: AppBar( - title: Text("Settings"), + title: Text(AppLocalizations.of(context)?.settings ?? "Settings"), backgroundColor: Colors.blue, foregroundColor: Colors.white, ), @@ -103,7 +111,9 @@ class _EditProfileState extends State child: DropdownButtonFormField( decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Define kilometer', + labelText: + AppLocalizations.of(context)?.define_kilometer ?? + 'Define kilometer', ), value: kilometer, // Set the initial selected value here, or leave as `null` if unselected. @@ -147,7 +157,7 @@ class _EditProfileState extends State child: TextButton( onPressed: () {}, child: Text( - 'Mettre à jour', + AppLocalizations.of(context)?.update ?? "Update", style: TextStyle(color: Colors.white, fontSize: 25), ), ), -- 2.49.1 From 22d0581da38295de1efbb36ba91d1ffe48cf04ff Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Fri, 25 Jul 2025 23:44:58 +0200 Subject: [PATCH 25/38] translate forgotpassword 100% --- covas_mobile/lib/l10n/app_en.arb | 3 +- covas_mobile/lib/l10n/app_fr.arb | 3 +- covas_mobile/lib/pages/ForgotPassword.dart | 37 +++++++++++++++------- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index e929000..55bdb80 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -90,5 +90,6 @@ "updated": "Updated", "settings_updated": "Settings updated", "define_kilometer": "Define Kilometer", -"settings": "Settings" +"settings": "Settings", +"email_sent": "Email has been sent" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index f5133bc..7ebda89 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -90,6 +90,7 @@ "updated": "Mis à jour", "settings_updated": "Paramètre mis à jour", "define_kilometer": "Definir un kilomètre", -"settings": "Paramètres" +"settings": "Paramètres", +"email_sent": "Email a été envoyé" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/ForgotPassword.dart b/covas_mobile/lib/pages/ForgotPassword.dart index 8b57978..20c8917 100644 --- a/covas_mobile/lib/pages/ForgotPassword.dart +++ b/covas_mobile/lib/pages/ForgotPassword.dart @@ -11,6 +11,11 @@ import '../classes/alert.dart'; import '../variable/globals.dart' as globals; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // + void main() { runApp(MyApp()); } @@ -74,22 +79,32 @@ class _PasswordForgotState extends State with ShowAlertDialog { })); print(responsePost.statusCode); if (responsePost.statusCode == 200) { - showAlertDialog(context, "Creation", "Un email a été envoyé à ${email}"); + String message = + AppLocalizations.of(context)?.email_sent ?? "Email has been sent"; + showAlertDialog( + context, + AppLocalizations.of(context)?.create ?? "Creation", + "${message} : ${email}"); return; } - final errorMessages = { - 400: "Requête mal construite", - 406: "Mot de passe incorrect", - 404: "Utilisateur inconnu", - 403: "Utilisateur désactivé", - 410: "Token invalide", - 500: "Problème interne du serveur", + final messages = { + 400: AppLocalizations.of(context)?.request_error ?? + "Poorly constructed query", + 406: AppLocalizations.of(context)?.incorrect_password ?? + "Incorrect password", + 404: AppLocalizations.of(context)?.unknown_user ?? "Unknown user", + 403: AppLocalizations.of(context)?.disabled_user ?? "Disabled user", + 410: AppLocalizations.of(context)?.invalid_token ?? "Invalid token", + 500: AppLocalizations.of(context)?.internal_error_server ?? + "Internal error server" }; - final text = errorMessages[responsePost.statusCode] ?? - "Problème d'authentification inconnu"; - showAlertDialog(context, "Erreur serveur", text); + final text = messages[responsePost.statusCode] ?? + AppLocalizations.of(context)?.unknown_error_auth ?? + "Unknown error auth"; + showAlertDialog( + context, AppLocalizations.of(context)?.error ?? "Error", text); } @override -- 2.49.1 From b48483c9f0fbcc305bc1e3d59bbee07ef0081dc0 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sat, 26 Jul 2025 19:00:28 +0200 Subject: [PATCH 26/38] translate forgotpassword 100% again --- covas_mobile/lib/l10n/app_en.arb | 5 ++++- covas_mobile/lib/l10n/app_fr.arb | 6 ++++-- covas_mobile/lib/pages/ForgotPassword.dart | 11 +++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 55bdb80..d6ba344 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -91,5 +91,8 @@ "settings_updated": "Settings updated", "define_kilometer": "Define Kilometer", "settings": "Settings", -"email_sent": "Email has been sent" +"email_sent": "Email has been sent", +"forgot_password": "Forgot password", +"enter_email": "Enter the email", +"send_email": "Send email" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 7ebda89..7b6937a 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -91,6 +91,8 @@ "settings_updated": "Paramètre mis à jour", "define_kilometer": "Definir un kilomètre", "settings": "Paramètres", -"email_sent": "Email a été envoyé" - +"email_sent": "Email a été envoyé", +"forgot_password": "Mot de passe oublié", +"enter_email": "Entrez l'email", +"send_email": "Send email" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/ForgotPassword.dart b/covas_mobile/lib/pages/ForgotPassword.dart index 20c8917..fb216c1 100644 --- a/covas_mobile/lib/pages/ForgotPassword.dart +++ b/covas_mobile/lib/pages/ForgotPassword.dart @@ -122,7 +122,8 @@ class _PasswordForgotState extends State with ShowAlertDialog { return Scaffold( backgroundColor: Colors.white, appBar: AppBar( - title: Text("Mot de passe oublie"), + title: Text(AppLocalizations.of(context)?.forgot_password ?? + "Forgot password"), backgroundColor: Colors.blue, foregroundColor: Colors.white, ), @@ -140,8 +141,10 @@ class _PasswordForgotState extends State with ShowAlertDialog { validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Email', - hintText: 'Modifier l\'adresse mail'), + labelText: + AppLocalizations.of(context)?.email ?? 'Email', + hintText: AppLocalizations.of(context)?.enter_email ?? + 'Enter the email'), ), ), SizedBox( @@ -160,7 +163,7 @@ class _PasswordForgotState extends State with ShowAlertDialog { } }, child: Text( - 'Envoyer le mail', + AppLocalizations.of(context)?.send_email ?? 'Send email', style: TextStyle(color: Colors.white, fontSize: 25), ), ), -- 2.49.1 From b4b0199fc237e59ecef1e098d6ef334ff03fd1e8 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sat, 26 Jul 2025 19:23:59 +0200 Subject: [PATCH 27/38] ItemMenu 100% --- covas_mobile/lib/l10n/app_en.arb | 8 ++++- covas_mobile/lib/l10n/app_fr.arb | 8 ++++- covas_mobile/lib/pages/ItemMenu.dart | 50 +++++++++++++++++----------- 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index d6ba344..79e86c4 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -94,5 +94,11 @@ "email_sent": "Email has been sent", "forgot_password": "Forgot password", "enter_email": "Enter the email", -"send_email": "Send email" +"send_email": "Send email", +"invalid_cache": "Invalid cache", +"item_date": "Date : ", +"item_maps": "Maps : ", +"item_organizer": "Organizer : ", +"item_description": "Description : ", +"item_tags": "Tags : " } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 7b6937a..520e908 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -94,5 +94,11 @@ "email_sent": "Email a été envoyé", "forgot_password": "Mot de passe oublié", "enter_email": "Entrez l'email", -"send_email": "Send email" +"send_email": "Send email", +"invalid_cache": "Cache invalide", +"item_date": "Date : ", +"item_maps": "Carte : ", +"item_organizer": "Organisateurs : ", +"item_description": "Description : ", +"item_tags": "Tags : " } \ No newline at end of file diff --git a/covas_mobile/lib/pages/ItemMenu.dart b/covas_mobile/lib/pages/ItemMenu.dart index 8b18d0a..896a66d 100644 --- a/covas_mobile/lib/pages/ItemMenu.dart +++ b/covas_mobile/lib/pages/ItemMenu.dart @@ -25,6 +25,11 @@ import '../classes/ad_helper.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import '../classes/auth_service.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // + void main() async { WidgetsFlutterBinding.ensureInitialized(); await MobileAds.instance.initialize(); @@ -109,7 +114,8 @@ class _ItemMenuState extends State with ShowAlertDialog { final accessToken = prefs.getString("access_token") ?? ""; if (accessToken.isEmpty) { - showAlertDialog(context, "Erreur serveur", "Cache invalide"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.invalid_cache ?? "Invalid cache"); return; } @@ -119,11 +125,8 @@ class _ItemMenuState extends State with ShowAlertDialog { headers: {HttpHeaders.cookieHeader: 'access_token=$accessToken'}, ); - stderr.writeln('Response Get status: ${responseGet.statusCode}'); - if (responseGet.statusCode == 200) { final responseBody = utf8.decode(responseGet.bodyBytes); - stderr.writeln('Username : $responseBody'); final event = Events.fromJson(jsonDecode(responseBody)); @@ -147,18 +150,23 @@ class _ItemMenuState extends State with ShowAlertDialog { tags = List.from(event.tags ?? []); }); } else { - final errorMessages = { - 400: "Requête mal construite", - 406: "Mot de passe incorrect", - 404: "Utilisateur inconnu", - 403: "Vous n'avez pas l'autorisation de faire cette action", - 410: "Token invalide", - 500: "Problème interne du serveur", + final messages = { + 400: AppLocalizations.of(context)?.request_error ?? + "Poorly constructed query", + 406: AppLocalizations.of(context)?.incorrect_password ?? + "Incorrect password", + 404: AppLocalizations.of(context)?.unknown_user ?? "Unknown user", + 403: AppLocalizations.of(context)?.disabled_user ?? "Disabled user", + 410: AppLocalizations.of(context)?.invalid_token ?? "Invalid token", + 500: AppLocalizations.of(context)?.internal_error_server ?? + "Internal error server" }; - final errorMessage = errorMessages[responseGet.statusCode] ?? - "Problème d'authentification inconnu"; - showAlertDialog(context, "Erreur serveur", errorMessage); + final errorMessage = messages[responseGet.statusCode] ?? + AppLocalizations.of(context)?.unknown_error_auth ?? + "Unknown error auth"; + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + errorMessage); } } @@ -223,7 +231,7 @@ class _ItemMenuState extends State with ShowAlertDialog { Row(children: [ Icon(Icons.event), Text( - "Date : ", + AppLocalizations.of(context)?.item_date ?? "Date : ", style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold), ) ]), @@ -237,7 +245,7 @@ class _ItemMenuState extends State with ShowAlertDialog { Row(children: [ Icon(Icons.explore), Text( - "Carte : ", + AppLocalizations.of(context)?.item_maps ?? "Maps : ", style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold), ) ]), @@ -260,7 +268,7 @@ class _ItemMenuState extends State with ShowAlertDialog { Row(children: [ Icon(Icons.group), Text( - "Organisateurs : ", + AppLocalizations.of(context)?.item_organizer ?? "Organizers : ", style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold), ) ]), @@ -313,7 +321,9 @@ class _ItemMenuState extends State with ShowAlertDialog { ]), Row(children: [ Icon(Icons.description), - Text("Description : ", + Text( + AppLocalizations.of(context)?.item_description ?? + "Description : ", style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold)) ]), Row(children: [ @@ -325,7 +335,7 @@ class _ItemMenuState extends State with ShowAlertDialog { ]), Row(children: [ Icon(Icons.category), - Text("Tags : ", + Text(AppLocalizations.of(context)?.item_tags ?? "Tags : ", style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold)) ]), Row( @@ -394,7 +404,7 @@ class _ItemMenuState extends State with ShowAlertDialog { ); }, backgroundColor: Colors.blue, - tooltip: 'Recherche', + tooltip: AppLocalizations.of(context)?.search ?? 'Search', child: const Icon(Icons.edit, color: Colors.white), ), ); -- 2.49.1 From 089aa58f4a316447a89e3c4ee4545504e5683af6 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 27 Jul 2025 12:13:52 +0200 Subject: [PATCH 28/38] ListItemOrganizer and Tags --- covas_mobile/lib/pages/ListItemByOrganizers.dart | 13 ++++++++++--- covas_mobile/lib/pages/ListItemByTags.dart | 11 +++++++++-- covas_mobile/lib/pages/LoginDemo.dart | 11 +++++++++-- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/covas_mobile/lib/pages/ListItemByOrganizers.dart b/covas_mobile/lib/pages/ListItemByOrganizers.dart index 84ff5e8..655b425 100644 --- a/covas_mobile/lib/pages/ListItemByOrganizers.dart +++ b/covas_mobile/lib/pages/ListItemByOrganizers.dart @@ -14,6 +14,11 @@ import '../classes/MyDrawer.dart'; import '../classes/auth_service.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // + // app starting point void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -76,7 +81,6 @@ class _MyHomePageState extends State { } Future _fetchData() async { - print("Counter : ${_fetchCount}"); if (_isLoading) return; setState(() { _isLoading = true; @@ -147,7 +151,8 @@ class _MyHomePageState extends State { return buildPosts(posts); } else { // if no data, show simple Text - return const Text("No data available"); + return Text( + AppLocalizations.of(context)?.no_data ?? "No data available"); } }, ), @@ -157,12 +162,14 @@ class _MyHomePageState extends State { // function to display fetched data on screen Widget buildPosts(List posts) { + String organizer = + AppLocalizations.of(context)?.item_organizer ?? "Organizer : "; // ListView Builder to show data in a list return Scaffold( appBar: AppBar( // Here we take the value from the MyHomePage object that was created by // the App.build method, and use it to set our appbar title. - title: Text("Organisateur : ${widget.organizer}", + title: Text("${organizer}${widget.organizer}", overflow: TextOverflow.ellipsis), backgroundColor: Colors.blue, foregroundColor: Colors.white, diff --git a/covas_mobile/lib/pages/ListItemByTags.dart b/covas_mobile/lib/pages/ListItemByTags.dart index 900e93d..017e2ec 100644 --- a/covas_mobile/lib/pages/ListItemByTags.dart +++ b/covas_mobile/lib/pages/ListItemByTags.dart @@ -15,6 +15,11 @@ import '../classes/MyDrawer.dart'; import '../classes/auth_service.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // + // app starting point void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -150,7 +155,8 @@ class _MyHomePageState extends State { return buildPosts(posts); } else { // if no data, show simple Text - return const Text("No data available"); + return Text( + AppLocalizations.of(context)?.no_data ?? "No data available"); } }, ), @@ -161,11 +167,12 @@ class _MyHomePageState extends State { // function to display fetched data on screen Widget buildPosts(List posts) { // ListView Builder to show data in a list + String tag = AppLocalizations.of(context)?.item_tags ?? "Tags : "; return Scaffold( appBar: AppBar( // Here we take the value from the MyHomePage object that was created by // the App.build method, and use it to set our appbar title. - title: Text("Tags : ${widget.tags}", overflow: TextOverflow.ellipsis), + title: Text("${tag}${widget.tags}", overflow: TextOverflow.ellipsis), backgroundColor: Colors.blue, foregroundColor: Colors.white, ), diff --git a/covas_mobile/lib/pages/LoginDemo.dart b/covas_mobile/lib/pages/LoginDemo.dart index 070271c..15bf799 100644 --- a/covas_mobile/lib/pages/LoginDemo.dart +++ b/covas_mobile/lib/pages/LoginDemo.dart @@ -8,6 +8,11 @@ import '../pages/ForgotPassword.dart'; import '../classes/alert.dart'; import '../classes/ad_helper.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // + class LoginDemo extends StatefulWidget { @override _LoginDemoState createState() => _LoginDemoState(); @@ -25,7 +30,8 @@ class _LoginDemoState extends State with ShowAlertDialog { final password = inputPassword.text; if (pseudo.isEmpty || password.isEmpty) { - showAlertDialog(context, "Erreur", "Champ vide"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.empty_input ?? "Empty input"); return; } @@ -36,7 +42,8 @@ class _LoginDemoState extends State with ShowAlertDialog { Navigator.push( context, MaterialPageRoute(builder: (_) => ListItemMenu())); } else { - showAlertDialog(context, "Erreur", "Échec de l'authentification"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + "Échec de l'authentification"); } } -- 2.49.1 From 2c2eedb7ce323a9c1745ecf95fb91ad8015cfa17 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 27 Jul 2025 15:16:38 +0200 Subject: [PATCH 29/38] translate loginpage 100% --- covas_mobile/lib/l10n/app_en.arb | 9 ++++++++- covas_mobile/lib/l10n/app_fr.arb | 9 ++++++++- covas_mobile/lib/pages/LoginDemo.dart | 28 +++++++++++++++++---------- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 79e86c4..92e78ac 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -100,5 +100,12 @@ "item_maps": "Maps : ", "item_organizer": "Organizer : ", "item_description": "Description : ", -"item_tags": "Tags : " +"item_tags": "Tags : ", +"failed_auth": "Authentification failed", +"login_page": "Login page", +"pseudo": "Pseudo", +"enter_existing_pseudo": "Enter a existing pseudo", +"remembr_me": "Remember me", +"new_user": "New User? Create Account", +"sign_in": "Sign in" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 520e908..7faca7e 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -100,5 +100,12 @@ "item_maps": "Carte : ", "item_organizer": "Organisateurs : ", "item_description": "Description : ", -"item_tags": "Tags : " +"item_tags": "Tags : ", +"failed_auth": "Échec de l'authenticaton", +"login_page": "Page d'authentification", +"pseudo": "Pseudo", +"enter_existing_pseudo": "Entrez un pseudo existant", +"remembr_me": "Se souvenir de moi", +"new_user": "Nouvel utilisateur ? Créer un compte", +"sign_in": "Se connecter" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/LoginDemo.dart b/covas_mobile/lib/pages/LoginDemo.dart index 15bf799..d6dd224 100644 --- a/covas_mobile/lib/pages/LoginDemo.dart +++ b/covas_mobile/lib/pages/LoginDemo.dart @@ -43,7 +43,7 @@ class _LoginDemoState extends State with ShowAlertDialog { context, MaterialPageRoute(builder: (_) => ListItemMenu())); } else { showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Échec de l'authentification"); + AppLocalizations.of(context)?.failed_auth ?? "Authentication failed"); } } @@ -80,7 +80,7 @@ class _LoginDemoState extends State with ShowAlertDialog { return Scaffold( backgroundColor: Colors.white, appBar: AppBar( - title: Text("Login Page"), + title: Text(AppLocalizations.of(context)?.login_page ?? "Login Page"), backgroundColor: Colors.blue, foregroundColor: Colors.white, ), @@ -100,8 +100,10 @@ class _LoginDemoState extends State with ShowAlertDialog { controller: inputPseudo, decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Pseudo', - hintText: 'Enter pseudo existant', + labelText: AppLocalizations.of(context)?.pseudo ?? 'Pseudo', + hintText: + AppLocalizations.of(context)?.enter_existing_pseudo ?? + 'Enter a existing pseudo', ), ), ), @@ -112,13 +114,16 @@ class _LoginDemoState extends State with ShowAlertDialog { obscureText: true, decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Password', - hintText: 'Enter secure password', + labelText: + AppLocalizations.of(context)?.password ?? "Password", + hintText: AppLocalizations.of(context)?.enter_password ?? + "Enter the password", ), ), ), CheckboxListTile( - title: Text("Se souvenir de moi"), + title: Text( + AppLocalizations.of(context)?.remembr_me ?? "Remember me"), value: _rememberMe, onChanged: (newValue) { setState(() { @@ -131,7 +136,9 @@ class _LoginDemoState extends State with ShowAlertDialog { Navigator.push(context, MaterialPageRoute(builder: (_) => PasswordForgot())); }, - child: Text('Forgot Password', + child: Text( + AppLocalizations.of(context)?.forgot_password ?? + 'Forgot Password', style: TextStyle(color: Colors.blue, fontSize: 15)), ), Container( @@ -141,13 +148,14 @@ class _LoginDemoState extends State with ShowAlertDialog { color: Colors.blue, borderRadius: BorderRadius.circular(20)), child: TextButton( onPressed: () => _login(context), - child: Text('Login', + child: Text(AppLocalizations.of(context)?.sign_in ?? 'Sign in', style: TextStyle(color: Colors.white, fontSize: 25)), ), ), SizedBox(height: 130), InkWell( - child: Text('New User? Create Account'), + child: Text(AppLocalizations.of(context)?.new_user ?? + 'New User? Create Account'), onTap: () { Navigator.push( context, MaterialPageRoute(builder: (_) => AddProfile())); -- 2.49.1 From dcc2ec25de3a39977b2f4c2e15d29f643c1c68fd Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 27 Jul 2025 20:04:55 +0200 Subject: [PATCH 30/38] translate mapbox page 10% --- covas_mobile/lib/l10n/app_en.arb | 2 +- covas_mobile/lib/pages/MapboxPages.dart | 71 +++++++++++++------------ 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 92e78ac..524b604 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -107,5 +107,5 @@ "enter_existing_pseudo": "Enter a existing pseudo", "remembr_me": "Remember me", "new_user": "New User? Create Account", -"sign_in": "Sign in" +"sign_in": "Sign in", } \ No newline at end of file diff --git a/covas_mobile/lib/pages/MapboxPages.dart b/covas_mobile/lib/pages/MapboxPages.dart index 8e005e9..8a8b412 100644 --- a/covas_mobile/lib/pages/MapboxPages.dart +++ b/covas_mobile/lib/pages/MapboxPages.dart @@ -13,6 +13,11 @@ import '../variable/globals.dart' as globals; import '../classes/MyDrawer.dart'; import '../classes/auth_service.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // + void main() async { await dotenv.load(fileName: ".env"); // Load .env file runApp(const MyApp()); @@ -69,8 +74,8 @@ class _MapboxPagesState extends State with ShowAlertDialog { void _initToken() { mapboxAccessToken = dotenv.env['MAPBOX_ACCESS_TOKEN'] ?? ''; if (mapboxAccessToken.isEmpty) { - showAlertDialog( - context, "Erreur Mapbox", "Mapbox Access Token is not available."); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + "Mapbox Access Token is not available."); } } @@ -95,43 +100,37 @@ class _MapboxPagesState extends State with ShowAlertDialog { _handleErrorResponse(responseGet.statusCode); } } else { - showAlertDialog(context, "Erreur serveur", "Invalid cache."); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.invalid_cache ?? "Invalid cache."); } } void _handleErrorResponse(int statusCode) { - String text; - switch (statusCode) { - case 400: - text = "Bad Request."; - break; - case 406: - text = "Incorrect Password."; - break; - case 404: - text = "User Not Found."; - break; - case 403: - text = "Action not permitted."; - break; - case 410: - text = "Invalid Token."; - break; - case 500: - text = "Internal Server Error."; - break; - default: - text = "Unknown error."; - } - showAlertDialog(context, "Erreur serveur", text); + final messages = { + 400: AppLocalizations.of(context)?.request_error ?? + "Poorly constructed query", + 406: AppLocalizations.of(context)?.incorrect_password ?? + "Incorrect password", + 404: AppLocalizations.of(context)?.unknown_user ?? "Unknown user", + 403: AppLocalizations.of(context)?.disabled_user ?? "Disabled user", + 410: AppLocalizations.of(context)?.invalid_token ?? "Invalid token", + 500: AppLocalizations.of(context)?.internal_error_server ?? + "Internal error server" + }; + + final errorMessage = messages[statusCode] ?? + AppLocalizations.of(context)?.unknown_error_auth ?? + "Unknown error auth"; + showAlertDialog( + context, AppLocalizations.of(context)?.error ?? "Error", errorMessage); } Future _getUserLocation() async { try { bool serviceEnabled = await Geolocator.isLocationServiceEnabled(); if (!serviceEnabled) { - showAlertDialog( - context, "Erreur de service", "Location services are disabled."); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + "Location services are disabled."); return; } @@ -139,14 +138,16 @@ class _MapboxPagesState extends State with ShowAlertDialog { if (permission == LocationPermission.denied) { permission = await Geolocator.requestPermission(); if (permission == LocationPermission.denied) { - showAlertDialog(context, "Erreur de permission", + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", "Location permissions are denied."); return; } } if (permission == LocationPermission.deniedForever) { - showAlertDialog(context, "Erreur de permission", + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", "Location permissions are permanently denied. Enable them in settings."); return; } @@ -158,7 +159,6 @@ class _MapboxPagesState extends State with ShowAlertDialog { locationSettings: locationSettings); } on LocationServiceDisabledException { // Handle location services disabled - print('Location services are disabled.'); position = await Geolocator.getLastKnownPosition(); if (position == null) { print('No last known position available.'); @@ -180,7 +180,8 @@ class _MapboxPagesState extends State with ShowAlertDialog { _initToken(); _getEventInfo(); } catch (e) { - showAlertDialog(context, "Erreur geo", "Failed to get user location: $e"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + "Failed to get user location: $e"); } } @@ -253,7 +254,7 @@ class _MapboxPagesState extends State with ShowAlertDialog { currentRouteLine = null; } if (!isUserPositionInitialized) { - showAlertDialog(context, "Erreur de position", + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", "User position is not yet initialized. Try again."); return; } @@ -293,7 +294,7 @@ class _MapboxPagesState extends State with ShowAlertDialog { _zoomToFitRoute(routeCoordinates); } } else { - showAlertDialog(context, "Erreur de coordonée", + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", "Invalid coordinates or user position."); } } -- 2.49.1 From 9e50b6d6f618e9bdfe5b967e454676c64ddcdbaa Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 27 Jul 2025 20:42:56 +0200 Subject: [PATCH 31/38] translate mapbox page 50% --- covas_mobile/lib/l10n/app_en.arb | 15 +++++++++++++ covas_mobile/lib/l10n/app_fr.arb | 17 ++++++++++++++- covas_mobile/lib/pages/MapboxPages.dart | 28 +++++++++++++++---------- 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 524b604..c70f2e7 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -108,4 +108,19 @@ "remembr_me": "Remember me", "new_user": "New User? Create Account", "sign_in": "Sign in", +"map_token": "Mapbox Access Token is not available", +"geo_disabled": "Location services are disabled.", +"permission_denied":"Location permissions are denied.", +"enable_permission": "Location permissions are permanently denied. Enable them in settings.", +"no_last_position": "No last known position available.", +"failed_location": "Failed to get user location", +"failed_fetch": "Failed to fetch the route", +"invalid_coordinates_symbol": "Invalid coordinates, cannot add symbol.", +"error_symbol": "Error when adding symbol.", +"position_not_init": "User position is not yet initialized. Try again.", +"invalid_coordinates": "Invalid coordinates.", +"walking": "Walking", +"cycling": "Cycling", +"driving": "Driving", +"get_direction": "Get Directions and Markers" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 7faca7e..66a789f 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -107,5 +107,20 @@ "enter_existing_pseudo": "Entrez un pseudo existant", "remembr_me": "Se souvenir de moi", "new_user": "Nouvel utilisateur ? Créer un compte", -"sign_in": "Se connecter" +"sign_in": "Se connecter", +"map_token": "Token d'accès de Mapbox n'est pas disponible", +"geo_disabled": "Les services de localisation sont désactivés.", +"permission_denied":"Les permissions de localisation sont refusées.", +"enable_permission": "Les permissions de localisation sont toujours désactivés. Il faut les désactiver", +"no_last_position": "Aucune position n'est pas disponible.", +"failed_location": "Échec de récupération des données geographique", +"failed_fetch": "Échec de récupération des routes", +"invalid_coordinates_symbol": "Coordonnées invalides. On ne peut pas ajouter le symbole", +"error_symbol": "Erreur lors de l'ajout du symbole", +"position_not_init": "Coordonnées non initialisées. Essaye encore.", +"invalid_coordinates": "Coordonnées invalides", +"walking": "Marche", +"cycling": "Vélo", +"driving": "Voiture", +"get_direction": "Get Directions and Markers" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/MapboxPages.dart b/covas_mobile/lib/pages/MapboxPages.dart index 8a8b412..0c314b9 100644 --- a/covas_mobile/lib/pages/MapboxPages.dart +++ b/covas_mobile/lib/pages/MapboxPages.dart @@ -161,14 +161,19 @@ class _MapboxPagesState extends State with ShowAlertDialog { // Handle location services disabled position = await Geolocator.getLastKnownPosition(); if (position == null) { - print('No last known position available.'); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + "No last known position available.."); } } catch (e) { // Handle other errors - print('Failed to get location: $e'); position = await Geolocator.getLastKnownPosition(); if (position == null) { - print('No last known position available.'); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + "No last known position available"); } } if (position != null) { @@ -201,7 +206,7 @@ class _MapboxPagesState extends State with ShowAlertDialog { }).toList(); }); } else { - showAlertDialog(context, "Erreur serveur", + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", "Failed to fetch the route: ${response.statusCode}"); } } @@ -209,8 +214,6 @@ class _MapboxPagesState extends State with ShowAlertDialog { // Called when the map is created void _onStyleLoaded() async { // Log the map controller and coordinates - print("Mapbox controller initialized: $mapController"); - print("lat - long : $latitude - $longitude"); // Check if the mapController is really initialized if (mapController != null) { @@ -230,20 +233,23 @@ class _MapboxPagesState extends State with ShowAlertDialog { ); // Debugging symbol options - print("Adding symbol with options: $symbolOptions"); // Add symbol to map mapController!.addSymbol(symbolOptions); } else { - print("Error: Invalid coordinates, cannot add symbol."); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + "Error: Invalid coordinates, cannot add symbol."); } } catch (e) { // Handle any exception that occurs when adding the symbol - print("Error when adding symbol: $e"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + "Error when adding symbol."); } } else { - print( - "Error: MapboxMapController is null at the time of symbol addition"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + "Error when adding symbol."); } } -- 2.49.1 From 119dfcbdfe90c06c804d0452334c128e59bbe715 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 27 Jul 2025 20:51:55 +0200 Subject: [PATCH 32/38] translate mapbox page 100% --- covas_mobile/lib/pages/MapboxPages.dart | 84 +++++++++++++++++-------- 1 file changed, 58 insertions(+), 26 deletions(-) diff --git a/covas_mobile/lib/pages/MapboxPages.dart b/covas_mobile/lib/pages/MapboxPages.dart index 0c314b9..549bc96 100644 --- a/covas_mobile/lib/pages/MapboxPages.dart +++ b/covas_mobile/lib/pages/MapboxPages.dart @@ -74,8 +74,11 @@ class _MapboxPagesState extends State with ShowAlertDialog { void _initToken() { mapboxAccessToken = dotenv.env['MAPBOX_ACCESS_TOKEN'] ?? ''; if (mapboxAccessToken.isEmpty) { - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Mapbox Access Token is not available."); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.map_token ?? + "Map Access Token is not available."); } } @@ -129,8 +132,11 @@ class _MapboxPagesState extends State with ShowAlertDialog { try { bool serviceEnabled = await Geolocator.isLocationServiceEnabled(); if (!serviceEnabled) { - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Location services are disabled."); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.geo_disabled ?? + "Location services are disabled."); return; } @@ -141,14 +147,18 @@ class _MapboxPagesState extends State with ShowAlertDialog { showAlertDialog( context, AppLocalizations.of(context)?.error ?? "Error", - "Location permissions are denied."); + AppLocalizations.of(context)?.permission_denied ?? + "Location permissions are denied."); return; } } if (permission == LocationPermission.deniedForever) { - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Location permissions are permanently denied. Enable them in settings."); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.enable_permission ?? + "Location permissions are permanently denied. Enable them in settings."); return; } const LocationSettings locationSettings = LocationSettings( @@ -164,7 +174,8 @@ class _MapboxPagesState extends State with ShowAlertDialog { showAlertDialog( context, AppLocalizations.of(context)?.error ?? "Error", - "No last known position available.."); + AppLocalizations.of(context)?.no_last_position ?? + "No last known position available.."); } } catch (e) { // Handle other errors @@ -173,7 +184,8 @@ class _MapboxPagesState extends State with ShowAlertDialog { showAlertDialog( context, AppLocalizations.of(context)?.error ?? "Error", - "No last known position available"); + AppLocalizations.of(context)?.no_last_position ?? + "No last known position available"); } } if (position != null) { @@ -185,8 +197,11 @@ class _MapboxPagesState extends State with ShowAlertDialog { _initToken(); _getEventInfo(); } catch (e) { - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Failed to get user location: $e"); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.failed_location ?? + "Failed to get user location"); } } @@ -206,8 +221,11 @@ class _MapboxPagesState extends State with ShowAlertDialog { }).toList(); }); } else { - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Failed to fetch the route: ${response.statusCode}"); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.failed_fetch ?? + "Failed to fetch the route"); } } @@ -240,16 +258,23 @@ class _MapboxPagesState extends State with ShowAlertDialog { showAlertDialog( context, AppLocalizations.of(context)?.error ?? "Error", - "Error: Invalid coordinates, cannot add symbol."); + AppLocalizations.of(context)?.invalid_coordinates_symbol ?? + "Error: Invalid coordinates, cannot add symbol."); } } catch (e) { // Handle any exception that occurs when adding the symbol - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Error when adding symbol."); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.error_symbol ?? + "Error when adding symbol."); } } else { - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Error when adding symbol."); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.error_symbol ?? + "Error when adding symbol."); } } @@ -260,8 +285,11 @@ class _MapboxPagesState extends State with ShowAlertDialog { currentRouteLine = null; } if (!isUserPositionInitialized) { - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "User position is not yet initialized. Try again."); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.position_not_init ?? + "User position is not yet initialized. Try again."); return; } @@ -300,8 +328,11 @@ class _MapboxPagesState extends State with ShowAlertDialog { _zoomToFitRoute(routeCoordinates); } } else { - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Invalid coordinates or user position."); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.invalid_coordinates ?? + "Invalid coordinates or user position."); } } @@ -355,7 +386,7 @@ class _MapboxPagesState extends State with ShowAlertDialog { children: [ Icon(Icons.directions_walk, color: Colors.blue), SizedBox(width: 8), - Text('Walking'), + Text(AppLocalizations.of(context)?.walking ?? 'Walking'), ], ), ), @@ -365,7 +396,7 @@ class _MapboxPagesState extends State with ShowAlertDialog { children: [ Icon(Icons.directions_bike, color: Colors.green), SizedBox(width: 8), - Text('Cycling'), + Text(AppLocalizations.of(context)?.cycling ?? 'Cycling'), ], ), ), @@ -375,7 +406,7 @@ class _MapboxPagesState extends State with ShowAlertDialog { children: [ Icon(Icons.directions_car, color: Colors.red), SizedBox(width: 8), - Text('Driving'), + Text(AppLocalizations.of(context)?.driving ?? 'Driving'), ], ), ), @@ -410,7 +441,8 @@ class _MapboxPagesState extends State with ShowAlertDialog { child: FloatingActionButton( onPressed: _drawRouteAndMarkers, child: Icon(Icons.directions), - tooltip: 'Get Directions and Markers', + tooltip: AppLocalizations.of(context)?.get_direction ?? + 'Get Directions and Markers', ), ), ], -- 2.49.1 From 5d02f2b1fbdf4df4afc073eacab97c49efc6aef7 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Mon, 28 Jul 2025 22:56:39 +0200 Subject: [PATCH 33/38] translate updateevent 50% --- covas_mobile/lib/pages/UpdateEventImage.dart | 109 ++++++++++++------- 1 file changed, 71 insertions(+), 38 deletions(-) diff --git a/covas_mobile/lib/pages/UpdateEventImage.dart b/covas_mobile/lib/pages/UpdateEventImage.dart index 2d46d2c..0c70e02 100644 --- a/covas_mobile/lib/pages/UpdateEventImage.dart +++ b/covas_mobile/lib/pages/UpdateEventImage.dart @@ -20,6 +20,11 @@ import '../classes/ad_helper.dart'; import 'package:google_mobile_ads/google_mobile_ads.dart'; import '../classes/auth_service.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import '../locale_provider.dart'; // + void main() async { WidgetsFlutterBinding.ensureInitialized(); await MobileAds.instance.initialize(); @@ -165,7 +170,8 @@ class _UpdateeventImageState extends State var endDate = "${endDateFormat}T${endTimepicker.text.replaceAll('-', ':')}"; if (!startDateCompare.isAfter(dateNow)) { - showAlertDialog(context, "Erreur evenement", "Evenement non futur"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.no_future_event ?? "No future event"); return; } @@ -173,7 +179,8 @@ class _UpdateeventImageState extends State var accessToken = prefs.getString("access_token") ?? ""; if (accessToken.isEmpty) { - showAlertDialog(context, "Erreur token", "Token d'accès manquant"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + "Token d'accès manquant"); return; } @@ -188,14 +195,15 @@ class _UpdateeventImageState extends State final searchboxResponse = await http.get(searchboxUrl); if (searchboxResponse.statusCode != 200) { - showAlertDialog(context, "Erreur map", + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", "Erreur lors de la géocodage avec Searchbox"); return; } final searchboxData = json.decode(searchboxResponse.body); if (searchboxData['results'].isEmpty) { - showAlertDialog(context, "Erreur", "Lieu introuvable"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + "Lieu introuvable"); return; } @@ -239,8 +247,8 @@ class _UpdateeventImageState extends State await http.Response.fromStream(await imgbbRequest.send()); if (imgbbResponse.statusCode != 200) { - showAlertDialog( - context, "Erreur serveur", "Erreur lors de l'upload d'image"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + "Erreur lors de l'upload d'image"); return; } @@ -276,22 +284,26 @@ class _UpdateeventImageState extends State handleHttpError(eventResponse.statusCode, context); } } catch (e) { - showAlertDialog(context, "Erreur", "Erreur: ${e.toString()}"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + "Erreur: ${e.toString()}"); } } // Utility function to handle HTTP errors void handleHttpError(int statusCode, BuildContext context) { - final errorMessages = { - 400: "Requête mal construite", - 403: "Utilisateur désactivé", - 404: "Utilisateur inconnu", - 406: "Mot de passe incorrect", - 410: "Token invalide", - 500: "Problème interne du serveur", + final messages = { + 400: AppLocalizations.of(context)?.request_error ?? + "Poorly constructed query", + 406: AppLocalizations.of(context)?.incorrect_password ?? + "Incorrect password", + 404: AppLocalizations.of(context)?.unknown_user ?? "Unknown user", + 403: AppLocalizations.of(context)?.disabled_user ?? "Disabled user", + 410: AppLocalizations.of(context)?.invalid_token ?? "Invalid token", + 500: AppLocalizations.of(context)?.internal_error_server ?? + "Internal error server" }; - showAlertDialog(context, "Erreur serveur", - errorMessages[statusCode] ?? "Erreur inconnue"); + showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", + messages[statusCode] ?? "Unknown error"); } void start() async { @@ -344,11 +356,9 @@ class _UpdateeventImageState extends State // Perform the request final response = await http.get(searchboxUrl); - print("response code suggestion: ${response.statusCode}"); if (response.statusCode == 200) { final data = json.decode(response.body); - print("data suggestion: ${data}"); setState(() { // Map the results to extract name and full_address @@ -432,7 +442,8 @@ class _UpdateeventImageState extends State return Scaffold( backgroundColor: Colors.white, appBar: AppBar( - title: Text("Add or Update a event"), + title: Text(AppLocalizations.of(context)?.add_event ?? + "Add or Update a event"), backgroundColor: Colors.blue, foregroundColor: Colors.white, ), @@ -467,8 +478,10 @@ class _UpdateeventImageState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Nom', - hintText: 'Modifier le nom de l\'évènement'), + labelText: AppLocalizations.of(context)?.name ?? "Name", + hintText: + AppLocalizations.of(context)?.edit_event_name ?? + "Edit event name"), ), ), _buildGeographicalZoneSearchField(), @@ -482,8 +495,10 @@ class _UpdateeventImageState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Date de debut', - hintText: 'Cliquez ici pour selectionner une date'), + labelText: AppLocalizations.of(context)?.start_date ?? + "Start date", + hintText: AppLocalizations.of(context)?.select_date ?? + "Click to select a date"), onTap: () => onTapFunctionDatePicker( context: context, position: "start")), ), @@ -497,8 +512,10 @@ class _UpdateeventImageState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Heure de debut', - hintText: 'Cliquez ici pour selectionner une heure'), + labelText: AppLocalizations.of(context)?.start_time ?? + "Start time", + hintText: AppLocalizations.of(context)?.select_time ?? + "Click to select a time"), onTap: () => onTapFunctionTimePicker( context: context, position: "start")), ), @@ -512,8 +529,10 @@ class _UpdateeventImageState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Date de fin', - hintText: 'Cliquez ici pour selectionner une date'), + labelText: AppLocalizations.of(context)?.end_date ?? + "End date", + hintText: AppLocalizations.of(context)?.select_date ?? + "Click to select a date"), onTap: () => onTapFunctionDatePicker( context: context, position: "end")), ), @@ -527,8 +546,10 @@ class _UpdateeventImageState extends State validator: (value) => _validateField(value), decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Heure de fin', - hintText: 'Cliquez ici pour selectionner une heure'), + labelText: AppLocalizations.of(context)?.end_time ?? + "End time", + hintText: AppLocalizations.of(context)?.select_time ?? + "Click to select a time"), onTap: () => onTapFunctionTimePicker( context: context, position: "end")), ), @@ -538,7 +559,8 @@ class _UpdateeventImageState extends State textSeparators: const [' ', ','], validator: (String tag) { if (_stringTagController.getTags!.contains(tag)) { - return 'Tu as deja rentre ce tag'; + return AppLocalizations.of(context)?.already_tag ?? + 'You have already entered this tag'; } return null; }, @@ -553,10 +575,12 @@ class _UpdateeventImageState extends State onSubmitted: inputFieldValues.onTagSubmitted, decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Tags', + labelText: + AppLocalizations.of(context)?.tag ?? 'Tags', hintText: inputFieldValues.tags.isNotEmpty ? '' - : "Enter tag...", + : AppLocalizations.of(context)?.enter_tag ?? + "Enter tag...", errorText: inputFieldValues.error, prefixIcon: inputFieldValues.tags.isNotEmpty ? SingleChildScrollView( @@ -633,7 +657,9 @@ class _UpdateeventImageState extends State textSeparators: const [','], validator: (String tag) { if (_stringOrgaController.getTags!.contains(tag)) { - return 'Cet organisateur est déjà rentré'; + return AppLocalizations.of(context) + ?.already_organiser ?? + 'You have already entered this organizer'; } return null; }, @@ -648,10 +674,14 @@ class _UpdateeventImageState extends State onSubmitted: inputFieldValues.onTagSubmitted, decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Organisateurs', + labelText: + AppLocalizations.of(context)?.organizer ?? + 'Organizers', hintText: inputFieldValues.tags.isNotEmpty ? '' - : "Enter un organisateur...", + : AppLocalizations.of(context) + ?.enter_organizer ?? + "Enter un organisateur...", errorText: inputFieldValues.error, prefixIcon: inputFieldValues.tags.isNotEmpty ? SingleChildScrollView( @@ -732,8 +762,11 @@ class _UpdateeventImageState extends State maxLines: 10, decoration: InputDecoration( border: OutlineInputBorder(), - labelText: 'Description', - hintText: 'Décrire l\'evènement'), + labelText: AppLocalizations.of(context)?.description ?? + 'Description', + hintText: + AppLocalizations.of(context)?.describe_event ?? + 'Describe the event'), ), ), SizedBox( @@ -752,7 +785,7 @@ class _UpdateeventImageState extends State } }, child: Text( - 'Ajouter', + AppLocalizations.of(context)?.add_event ?? 'Add', style: TextStyle(color: Colors.white, fontSize: 25), ), ), -- 2.49.1 From e310197aa7677aa1289404c49c7a19083fae7ed9 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Mon, 28 Jul 2025 23:21:37 +0200 Subject: [PATCH 34/38] translate updateevent 100% --- covas_mobile/lib/l10n/app_en.arb | 9 +++- covas_mobile/lib/l10n/app_fr.arb | 9 +++- covas_mobile/lib/pages/UpdateEventImage.dart | 43 ++++++++++++++------ 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index c70f2e7..87c6c52 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -122,5 +122,12 @@ "walking": "Walking", "cycling": "Cycling", "driving": "Driving", -"get_direction": "Get Directions and Markers" +"get_direction": "Get Directions and Markers", +"missing_token": "Missing access token", +"geocoding_error": "Error when geocoding", +"no_found_place": "No found place", +"upload_error": "Error when image uploading", +"event_added": "Event added", +"unknown_error": "Unknown error", +"app_error": "Application error" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 66a789f..b25d67d 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -122,5 +122,12 @@ "walking": "Marche", "cycling": "Vélo", "driving": "Voiture", -"get_direction": "Get Directions and Markers" +"get_direction": "Get Directions and Markers", +"missing_token": "Token d'accès manquant", +"geocoding_error": "Erreur lors du geocodage", +"no_found_place": "Lieu introuvable", +"upload_error": "Erreur lors de l'upload d'image", +"event_added": "Évènement ajouté", +"unknown_error": "Erreur inconnue", +"app_error": "Erreur d'application" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/UpdateEventImage.dart b/covas_mobile/lib/pages/UpdateEventImage.dart index 0c70e02..0a08e25 100644 --- a/covas_mobile/lib/pages/UpdateEventImage.dart +++ b/covas_mobile/lib/pages/UpdateEventImage.dart @@ -179,8 +179,11 @@ class _UpdateeventImageState extends State var accessToken = prefs.getString("access_token") ?? ""; if (accessToken.isEmpty) { - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Token d'accès manquant"); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.missing_token ?? + "Missing access token"); return; } @@ -195,15 +198,18 @@ class _UpdateeventImageState extends State final searchboxResponse = await http.get(searchboxUrl); if (searchboxResponse.statusCode != 200) { - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Erreur lors de la géocodage avec Searchbox"); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.geocoding_error ?? + "Error when geocoding"); return; } final searchboxData = json.decode(searchboxResponse.body); if (searchboxData['results'].isEmpty) { showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Lieu introuvable"); + AppLocalizations.of(context)?.no_found_place ?? "No found place"); return; } @@ -247,8 +253,11 @@ class _UpdateeventImageState extends State await http.Response.fromStream(await imgbbRequest.send()); if (imgbbResponse.statusCode != 200) { - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Erreur lors de l'upload d'image"); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + AppLocalizations.of(context)?.upload_error ?? + "Error when image uploading"); return; } @@ -279,13 +288,15 @@ class _UpdateeventImageState extends State ); if (eventResponse.statusCode == 200 || eventResponse.statusCode == 201) { - showEventDialog(context, "Événement $name ajouté"); + String event_message = + AppLocalizations.of(context)?.event_added ?? "Event added"; + showEventDialog(context, "$event_message : $name"); } else { handleHttpError(eventResponse.statusCode, context); } } catch (e) { showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - "Erreur: ${e.toString()}"); + AppLocalizations.of(context)?.app_error ?? "Error application"); } } @@ -302,8 +313,12 @@ class _UpdateeventImageState extends State 500: AppLocalizations.of(context)?.internal_error_server ?? "Internal error server" }; - showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error", - messages[statusCode] ?? "Unknown error"); + showAlertDialog( + context, + AppLocalizations.of(context)?.error ?? "Error", + messages[statusCode] ?? + AppLocalizations.of(context)?.unknown_error ?? + "Unknown error"); } void start() async { @@ -342,7 +357,9 @@ class _UpdateeventImageState extends State final _formKey = GlobalKey(); String? _validateField(String? value) { - return value!.isEmpty ? 'Champ requis' : null; + return value!.isEmpty + ? AppLocalizations.of(context)?.required_input ?? 'Required input' + : null; } Future searchSuggestions(String input) async { @@ -384,7 +401,7 @@ class _UpdateeventImageState extends State TextField( controller: inputGeo, decoration: InputDecoration( - labelText: 'Lieu', + labelText: AppLocalizations.of(context)?.location ?? 'Location', border: OutlineInputBorder(), suffixIcon: IconButton( icon: const Icon(Icons.clear), -- 2.49.1 From 7a418d82a79377679370e7ad87f4e87f33f20595 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Tue, 29 Jul 2025 21:21:21 +0200 Subject: [PATCH 35/38] Add german translation --- covas_mobile/lib/classes/MyDrawer.dart | 9 ++ covas_mobile/lib/l10n/app_de.arb | 132 +++++++++++++++++++++++++ covas_mobile/lib/l10n/app_en.arb | 1 + covas_mobile/lib/l10n/app_fr.arb | 1 + covas_mobile/lib/locale_provider.dart | 1 + covas_mobile/lib/main.dart | 5 +- 6 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 covas_mobile/lib/l10n/app_de.arb diff --git a/covas_mobile/lib/classes/MyDrawer.dart b/covas_mobile/lib/classes/MyDrawer.dart index 6272d76..8fcf62c 100644 --- a/covas_mobile/lib/classes/MyDrawer.dart +++ b/covas_mobile/lib/classes/MyDrawer.dart @@ -170,6 +170,15 @@ class MyDrawer extends StatelessWidget with ShowAlertDialog { Navigator.of(context).pop(); }, ), + ListTile( + leading: Icon(Icons.flag_outlined), + title: Text(loc?.german ?? 'German'), + onTap: () { + Provider.of(context, listen: false) + .setLocale(const Locale('de')); + Navigator.of(context).pop(); + }, + ), ], ), ), diff --git a/covas_mobile/lib/l10n/app_de.arb b/covas_mobile/lib/l10n/app_de.arb new file mode 100644 index 0000000..7c76c02 --- /dev/null +++ b/covas_mobile/lib/l10n/app_de.arb @@ -0,0 +1,132 @@ +{ + "@@locale": "de", + "menu_list": "Veranstaltungsmenü", + "language": "Sprache", + "home": "Startseite", + "settings": "Einstellungen", + "update_profile": "Profil aktualisieren", + "about": "Über", + "log_out": "Abmelden", + "french": "Französisch", + "english": "Englisch", + "german": "Deutsch", + "select_language": "Sprache auswählen", + "search_item": "Nach Element suchen", + "search_tag": "Nach Schlagwörtern suchen", + "search_geographical": "Nach geografischer Zone suchen", + "show_date_field": "Datumsfelder anzeigen", + "hide_date_field": "Datumsfelder ausblenden", + "no_data": "Keine Daten verfügbar", + "search": "Suchen", + "no_events": "Keine Veranstaltungen für diesen Ort verfügbar.", + "start_date": "Anfangsdatum", + "end_date": "Enddatum", + "failed_suggestions": "Vorschläge konnten nicht geladen werden", + "error": "Fehler", + "password_different": "Ein anderes Passwort eingeben", + "create": "Erstellung", + "user_create": "Benutzer wurde erstellt", + "user_update": "Benutzer wurde aktualisiert", + "request_error": "Fehlerhafte Anfrage", + "incorrect_password": "Falsches Passwort", + "unknown_user": "Unbekannter Benutzer", + "disabled_user": "Benutzer deaktiviert", + "invalid_token": "Ungültiger Token", + "internal_error_server": "Interner Serverfehler", + "unknown_error_auth": "Unbekannter Authentifizierungsfehler", + "required_input": "Pflichtfeld", + "create_profile": "Profil erstellen", + "edit_pseudo": "Benutzernamen bearbeiten", + "password": "Passwort", + "enter_password": "Passwort eingeben", + "password_confirmed": "Passwort bestätigt", + "last_name": "Nachname", + "first_name": "Vorname", + "email": "E-Mail", + "edit_last_name": "Nachnamen bearbeiten", + "edit_first_name": "Vornamen bearbeiten", + "edit_email": "E-Mail-Adresse bearbeiten", + "birth_date": "Geburtsdatum", + "edit_birth": "Geburtsdatum bearbeiten", + "create_profile_button": "Profil erstellen", + "take_picture": "Foto aufnehmen", + "error_ia": "Google KI konnte das Bild nicht analysieren. Bitte ein anderes versuchen.", + "no_data_geo": "Keine geografischen Daten", + "response_status_update": "Statuscode-Antwort aktualisieren", + "error_token": "Token-Fehler", + "error_format": "Vom KI geliefertes Datenformat ist fehlerhaft", + "display_picture": "Bild anzeigen", + "analyze_image": "Bildanalyse läuft", + "loading_progress": "Ladefortschritt", + "error_event": "Veranstaltungsfehler", + "no_future_event": "Keine zukünftigen Veranstaltungen", + "error_user": "Benutzerfehler", + "empty_input": "Eingabefeld leer", + "info_event": "Veranstaltungsinfo", + "event_already": "Veranstaltung existiert bereits", + "picture_error": "Bildfehler", + "no_picture_published": "Kein Bild veröffentlicht", + "event_update": "Veranstaltung aktualisiert", + "location": "Ort", + "add_event": "Veranstaltung hinzufügen oder aktualisieren", + "edit_image": "Bilder bearbeiten", + "name": "Name", + "edit_event_name": "Veranstaltungsname bearbeiten", + "start_time": "Startzeit", + "end_time": "Endzeit", + "select_date": "Zum Auswählen eines Datums klicken", + "select_time": "Zum Auswählen einer Uhrzeit klicken", + "tag": "Schlagwörter", + "already_tag": "Dieses Schlagwort ist bereits vorhanden", + "enter_tag": "Ein Schlagwort eingeben", + "organizer": "Veranstalter", + "already_organiser": "Veranstalter bereits vorhanden", + "enter_organizer": "Veranstalter eingeben", + "description": "Beschreibung", + "describe_event": "Veranstaltung beschreiben", + "add": "Hinzufügen", + "different_password_error": "Passwörter stimmen nicht überein", + "update": "Aktualisieren", + "updated": "Aktualisiert", + "settings_updated": "Einstellungen aktualisiert", + "define_kilometer": "Kilometer definieren", + "email_sent": "E-Mail wurde gesendet", + "forgot_password": "Passwort vergessen", + "enter_email": "E-Mail eingeben", + "send_email": "E-Mail senden", + "invalid_cache": "Ungültiger Cache", + "item_date": "Datum : ", + "item_maps": "Karte : ", + "item_organizer": "Veranstalter : ", + "item_description": "Beschreibung : ", + "item_tags": "Schlagwörter : ", + "failed_auth": "Authentifizierung fehlgeschlagen", + "login_page": "Anmeldeseite", + "pseudo": "Benutzername", + "enter_existing_pseudo": "Vorhandenen Benutzernamen eingeben", + "remembr_me": "Angemeldet bleiben", + "new_user": "Neuer Benutzer? Konto erstellen", + "sign_in": "Anmelden", + "map_token": "Mapbox-Zugangstoken ist nicht verfügbar", + "geo_disabled": "Standortdienste sind deaktiviert.", + "permission_denied": "Standortberechtigungen wurden verweigert.", + "enable_permission": "Standortberechtigungen dauerhaft verweigert. Bitte in den Einstellungen aktivieren.", + "no_last_position": "Keine letzte bekannte Position verfügbar.", + "failed_location": "Standort konnte nicht ermittelt werden", + "failed_fetch": "Route konnte nicht abgerufen werden", + "invalid_coordinates_symbol": "Ungültige Koordinaten, Symbol kann nicht hinzugefügt werden.", + "error_symbol": "Fehler beim Hinzufügen des Symbols.", + "position_not_init": "Benutzerposition noch nicht initialisiert. Erneut versuchen.", + "invalid_coordinates": "Ungültige Koordinaten.", + "walking": "Zu Fuß", + "cycling": "Mit dem Fahrrad", + "driving": "Mit dem Auto", + "get_direction": "Wegbeschreibung und Markierungen anzeigen", + "missing_token": "Zugangstoken fehlt", + "geocoding_error": "Fehler bei der Geokodierung", + "no_found_place": "Kein Ort gefunden", + "upload_error": "Fehler beim Hochladen des Bildes", + "event_added": "Veranstaltung hinzugefügt", + "unknown_error": "Unbekannter Fehler", + "app_error": "Anwendungsfehler" +} diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 87c6c52..361954d 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -9,6 +9,7 @@ "log_out": "Log out", "french": "French", "english": "English", +"german": "German", "select_language": "Select language", "search_item": "Search by item", "search_tag": "Search by tags", diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index b25d67d..5cdada9 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -9,6 +9,7 @@ "log_out": "Se déconnecter", "french": "Français", "english": "Anglais", +"german": "Allemand", "select_language": "Selectionne la langue", "search_item": "Recherche par item", "search_tag": "Recherche par tags", diff --git a/covas_mobile/lib/locale_provider.dart b/covas_mobile/lib/locale_provider.dart index b8c9c7a..4f5ac79 100644 --- a/covas_mobile/lib/locale_provider.dart +++ b/covas_mobile/lib/locale_provider.dart @@ -17,5 +17,6 @@ class L10n { static final all = [ const Locale('en'), const Locale('fr'), + const Locale('de') ]; } diff --git a/covas_mobile/lib/main.dart b/covas_mobile/lib/main.dart index 11346a0..c2af5df 100644 --- a/covas_mobile/lib/main.dart +++ b/covas_mobile/lib/main.dart @@ -26,10 +26,7 @@ class MyApp extends StatelessWidget { return MaterialApp( debugShowCheckedModeBanner: false, locale: localeProvider.locale, // <-- utilise la locale courante - supportedLocales: const [ - Locale('en'), - Locale('fr'), - ], + supportedLocales: const [Locale('en'), Locale('fr'), Locale('de')], localizationsDelegates: AppLocalizations.localizationsDelegates, home: LoginDemo(), ); -- 2.49.1 From cbc75bbc7bafa257c67e06f08d4078dd104812e9 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 30 Jul 2025 23:54:15 +0200 Subject: [PATCH 36/38] translate date --- covas_mobile/lib/l10n/app_de.arb | 4 +++- covas_mobile/lib/l10n/app_en.arb | 4 +++- covas_mobile/lib/l10n/app_fr.arb | 5 ++++- covas_mobile/lib/pages/ItemMenu.dart | 21 ++++++++++++++++----- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/covas_mobile/lib/l10n/app_de.arb b/covas_mobile/lib/l10n/app_de.arb index 7c76c02..9194d0a 100644 --- a/covas_mobile/lib/l10n/app_de.arb +++ b/covas_mobile/lib/l10n/app_de.arb @@ -128,5 +128,7 @@ "upload_error": "Fehler beim Hochladen des Bildes", "event_added": "Veranstaltung hinzugefügt", "unknown_error": "Unbekannter Fehler", - "app_error": "Anwendungsfehler" + "app_error": "Anwendungsfehler", + "at": "um", + "to_date": "bis" } diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index 361954d..2f29651 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -130,5 +130,7 @@ "upload_error": "Error when image uploading", "event_added": "Event added", "unknown_error": "Unknown error", -"app_error": "Application error" +"app_error": "Application error", +"at": "at", +"to_date": "to" } \ No newline at end of file diff --git a/covas_mobile/lib/l10n/app_fr.arb b/covas_mobile/lib/l10n/app_fr.arb index 5cdada9..c3dd1fd 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -130,5 +130,8 @@ "upload_error": "Erreur lors de l'upload d'image", "event_added": "Évènement ajouté", "unknown_error": "Erreur inconnue", -"app_error": "Erreur d'application" +"app_error": "Erreur d'application", +"at": "à", +"to_date": "jusqu'à" + } \ No newline at end of file diff --git a/covas_mobile/lib/pages/ItemMenu.dart b/covas_mobile/lib/pages/ItemMenu.dart index 896a66d..7451e50 100644 --- a/covas_mobile/lib/pages/ItemMenu.dart +++ b/covas_mobile/lib/pages/ItemMenu.dart @@ -129,20 +129,31 @@ class _ItemMenuState extends State with ShowAlertDialog { final responseBody = utf8.decode(responseGet.bodyBytes); final event = Events.fromJson(jsonDecode(responseBody)); - + final locale = Provider.of(context, listen: false) + .locale + ?.toString() ?? + 'en_US'; final startDate = DateTime.parse(event.startDate ?? DateTime.now().toString()); + //final date = DateFormat.yMd().format(startDate); + //final time = DateFormat.Hm().format(startDate); final endDate = DateTime.parse(event.endDate ?? DateTime.now().toString()); - + String separator = AppLocalizations.of(context)?.at ?? "at"; final formattedStartDate = - "${DateFormat.yMd().format(startDate)} ${DateFormat.Hm().format(startDate)}"; + DateFormat("EEEE d MMMM y '${separator}' HH:mm", locale) + .format(startDate); + final formattedEndDate = - "${DateFormat.yMd().format(endDate)} ${DateFormat.Hm().format(endDate)}"; + DateFormat("EEEE d MMMM y '${separator}' HH:mm", locale) + .format(endDate); + + String link = AppLocalizations.of(context)?.to_date ?? "to"; setState(() { eventName = event.name ?? ""; - eventStartDate = "$formattedStartDate à $formattedEndDate"; + + eventStartDate = "$formattedStartDate ${link} $formattedEndDate"; organizers = List.from(event.organizers ?? []); place = event.place ?? ""; imgUrl = event.imgUrl ?? ""; -- 2.49.1 From 0a62011b3a363a5f6c98d248f65665dea41cde83 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 6 Aug 2025 22:17:53 +0200 Subject: [PATCH 37/38] translate date on list by tag and by organizer --- covas_mobile/lib/pages/ListItemByOrganizers.dart | 7 ++++++- covas_mobile/lib/pages/ListItemByTags.dart | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/covas_mobile/lib/pages/ListItemByOrganizers.dart b/covas_mobile/lib/pages/ListItemByOrganizers.dart index 655b425..e0bcf08 100644 --- a/covas_mobile/lib/pages/ListItemByOrganizers.dart +++ b/covas_mobile/lib/pages/ListItemByOrganizers.dart @@ -183,8 +183,13 @@ class _MyHomePageState extends State { final post = posts[index]; final startDate = DateTime.parse(post.startDate!); + final locale = Provider.of(context, listen: false) + .locale + ?.toString() ?? + 'en_US'; + final dateLongue = - DateFormat('EEEE d MMMM y', 'fr_FR').format(startDate); + DateFormat('EEEE d MMMM y', locale).format(startDate); return ListTile( title: Text('${post.name!}'), diff --git a/covas_mobile/lib/pages/ListItemByTags.dart b/covas_mobile/lib/pages/ListItemByTags.dart index 017e2ec..97c8658 100644 --- a/covas_mobile/lib/pages/ListItemByTags.dart +++ b/covas_mobile/lib/pages/ListItemByTags.dart @@ -184,8 +184,12 @@ class _MyHomePageState extends State { itemBuilder: (context, index) { final post = posts[index]; final startDate = DateTime.parse(post.startDate!); + final locale = Provider.of(context, listen: false) + .locale + ?.toString() ?? + 'en_US'; final dateLongue = - DateFormat('EEEE d MMMM y', 'fr_FR').format(startDate); + DateFormat('EEEE d MMMM y', locale).format(startDate); return ListTile( title: Text('${post.name!}'), -- 2.49.1 From 76db2f825494781ec2e4adf5a3d6203f83c50fc7 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Wed, 6 Aug 2025 22:34:01 +0200 Subject: [PATCH 38/38] add cache for language --- covas_mobile/lib/locale_provider.dart | 21 ++++++++++++++++++++- covas_mobile/lib/main.dart | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/covas_mobile/lib/locale_provider.dart b/covas_mobile/lib/locale_provider.dart index 4f5ac79..0d90807 100644 --- a/covas_mobile/lib/locale_provider.dart +++ b/covas_mobile/lib/locale_provider.dart @@ -1,15 +1,34 @@ import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class LocaleProvider with ChangeNotifier { + static const _localeKey = 'locale_code'; + Locale _locale = const Locale('en'); Locale get locale => _locale; - void setLocale(Locale locale) { + LocaleProvider() { + _loadLocale(); + } + + Future _loadLocale() async { + final prefs = await SharedPreferences.getInstance(); + final code = prefs.getString(_localeKey); + if (code != null && L10n.all.contains(Locale(code))) { + _locale = Locale(code); + notifyListeners(); + } + } + + void setLocale(Locale locale) async { if (!L10n.all.contains(locale)) return; _locale = locale; notifyListeners(); + + final prefs = await SharedPreferences.getInstance(); + await prefs.setString(_localeKey, locale.languageCode); } } diff --git a/covas_mobile/lib/main.dart b/covas_mobile/lib/main.dart index c2af5df..f01e1a3 100644 --- a/covas_mobile/lib/main.dart +++ b/covas_mobile/lib/main.dart @@ -26,7 +26,7 @@ class MyApp extends StatelessWidget { return MaterialApp( debugShowCheckedModeBanner: false, locale: localeProvider.locale, // <-- utilise la locale courante - supportedLocales: const [Locale('en'), Locale('fr'), Locale('de')], + supportedLocales: L10n.all, localizationsDelegates: AppLocalizations.localizationsDelegates, home: LoginDemo(), ); -- 2.49.1