feature/internationale #46

Merged
v4l3n71n merged 38 commits from feature/internationale into main 2025-08-06 20:38:37 +00:00
22 changed files with 903 additions and 263 deletions
Showing only changes of commit 119dfcbdfe - Show all commits

View File

@@ -74,8 +74,11 @@ class _MapboxPagesState extends State<MapboxPages> 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<MapboxPages> 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<MapboxPages> 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<MapboxPages> 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<MapboxPages> 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<MapboxPages> 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<MapboxPages> 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<MapboxPages> 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<MapboxPages> 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<MapboxPages> 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<MapboxPages> 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<MapboxPages> 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<MapboxPages> 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<MapboxPages> 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',
),
),
],