From 9e50b6d6f618e9bdfe5b967e454676c64ddcdbaa Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 27 Jul 2025 20:42:56 +0200 Subject: [PATCH] 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."); } }