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);