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