translate updateevent 100%
This commit is contained in:
@@ -122,5 +122,12 @@
|
|||||||
"walking": "Walking",
|
"walking": "Walking",
|
||||||
"cycling": "Cycling",
|
"cycling": "Cycling",
|
||||||
"driving": "Driving",
|
"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"
|
||||||
}
|
}
|
@@ -122,5 +122,12 @@
|
|||||||
"walking": "Marche",
|
"walking": "Marche",
|
||||||
"cycling": "Vélo",
|
"cycling": "Vélo",
|
||||||
"driving": "Voiture",
|
"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"
|
||||||
}
|
}
|
@@ -179,8 +179,11 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
var accessToken = prefs.getString("access_token") ?? "";
|
var accessToken = prefs.getString("access_token") ?? "";
|
||||||
|
|
||||||
if (accessToken.isEmpty) {
|
if (accessToken.isEmpty) {
|
||||||
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
|
showAlertDialog(
|
||||||
"Token d'accès manquant");
|
context,
|
||||||
|
AppLocalizations.of(context)?.error ?? "Error",
|
||||||
|
AppLocalizations.of(context)?.missing_token ??
|
||||||
|
"Missing access token");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,15 +198,18 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
final searchboxResponse = await http.get(searchboxUrl);
|
final searchboxResponse = await http.get(searchboxUrl);
|
||||||
|
|
||||||
if (searchboxResponse.statusCode != 200) {
|
if (searchboxResponse.statusCode != 200) {
|
||||||
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
|
showAlertDialog(
|
||||||
"Erreur lors de la géocodage avec Searchbox");
|
context,
|
||||||
|
AppLocalizations.of(context)?.error ?? "Error",
|
||||||
|
AppLocalizations.of(context)?.geocoding_error ??
|
||||||
|
"Error when geocoding");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final searchboxData = json.decode(searchboxResponse.body);
|
final searchboxData = json.decode(searchboxResponse.body);
|
||||||
if (searchboxData['results'].isEmpty) {
|
if (searchboxData['results'].isEmpty) {
|
||||||
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
|
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
|
||||||
"Lieu introuvable");
|
AppLocalizations.of(context)?.no_found_place ?? "No found place");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,8 +253,11 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
await http.Response.fromStream(await imgbbRequest.send());
|
await http.Response.fromStream(await imgbbRequest.send());
|
||||||
|
|
||||||
if (imgbbResponse.statusCode != 200) {
|
if (imgbbResponse.statusCode != 200) {
|
||||||
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
|
showAlertDialog(
|
||||||
"Erreur lors de l'upload d'image");
|
context,
|
||||||
|
AppLocalizations.of(context)?.error ?? "Error",
|
||||||
|
AppLocalizations.of(context)?.upload_error ??
|
||||||
|
"Error when image uploading");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,13 +288,15 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (eventResponse.statusCode == 200 || eventResponse.statusCode == 201) {
|
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 {
|
} else {
|
||||||
handleHttpError(eventResponse.statusCode, context);
|
handleHttpError(eventResponse.statusCode, context);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
|
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<UpdateeventImage>
|
|||||||
500: AppLocalizations.of(context)?.internal_error_server ??
|
500: AppLocalizations.of(context)?.internal_error_server ??
|
||||||
"Internal error server"
|
"Internal error server"
|
||||||
};
|
};
|
||||||
showAlertDialog(context, AppLocalizations.of(context)?.error ?? "Error",
|
showAlertDialog(
|
||||||
messages[statusCode] ?? "Unknown error");
|
context,
|
||||||
|
AppLocalizations.of(context)?.error ?? "Error",
|
||||||
|
messages[statusCode] ??
|
||||||
|
AppLocalizations.of(context)?.unknown_error ??
|
||||||
|
"Unknown error");
|
||||||
}
|
}
|
||||||
|
|
||||||
void start() async {
|
void start() async {
|
||||||
@@ -342,7 +357,9 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
|
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
String? _validateField(String? value) {
|
String? _validateField(String? value) {
|
||||||
return value!.isEmpty ? 'Champ requis' : null;
|
return value!.isEmpty
|
||||||
|
? AppLocalizations.of(context)?.required_input ?? 'Required input'
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> searchSuggestions(String input) async {
|
Future<void> searchSuggestions(String input) async {
|
||||||
@@ -384,7 +401,7 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
|||||||
TextField(
|
TextField(
|
||||||
controller: inputGeo,
|
controller: inputGeo,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Lieu',
|
labelText: AppLocalizations.of(context)?.location ?? 'Location',
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
icon: const Icon(Icons.clear),
|
icon: const Icon(Icons.clear),
|
||||||
|
Reference in New Issue
Block a user