diff --git a/covas_mobile/lib/l10n/app_en.arb b/covas_mobile/lib/l10n/app_en.arb index e929000..55bdb80 100644 --- a/covas_mobile/lib/l10n/app_en.arb +++ b/covas_mobile/lib/l10n/app_en.arb @@ -90,5 +90,6 @@ "updated": "Updated", "settings_updated": "Settings updated", "define_kilometer": "Define Kilometer", -"settings": "Settings" +"settings": "Settings", +"email_sent": "Email has been sent" } \ 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 f5133bc..7ebda89 100644 --- a/covas_mobile/lib/l10n/app_fr.arb +++ b/covas_mobile/lib/l10n/app_fr.arb @@ -90,6 +90,7 @@ "updated": "Mis à jour", "settings_updated": "Paramètre mis à jour", "define_kilometer": "Definir un kilomètre", -"settings": "Paramètres" +"settings": "Paramètres", +"email_sent": "Email a été envoyé" } \ No newline at end of file diff --git a/covas_mobile/lib/pages/ForgotPassword.dart b/covas_mobile/lib/pages/ForgotPassword.dart index 8b57978..20c8917 100644 --- a/covas_mobile/lib/pages/ForgotPassword.dart +++ b/covas_mobile/lib/pages/ForgotPassword.dart @@ -11,6 +11,11 @@ import '../classes/alert.dart'; import '../variable/globals.dart' as globals; +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'; // + void main() { runApp(MyApp()); } @@ -74,22 +79,32 @@ class _PasswordForgotState extends State with ShowAlertDialog { })); print(responsePost.statusCode); if (responsePost.statusCode == 200) { - showAlertDialog(context, "Creation", "Un email a été envoyé à ${email}"); + String message = + AppLocalizations.of(context)?.email_sent ?? "Email has been sent"; + showAlertDialog( + context, + AppLocalizations.of(context)?.create ?? "Creation", + "${message} : ${email}"); return; } - final errorMessages = { - 400: "Requête mal construite", - 406: "Mot de passe incorrect", - 404: "Utilisateur inconnu", - 403: "Utilisateur désactivé", - 410: "Token invalide", - 500: "Problème interne du serveur", + final messages = { + 400: AppLocalizations.of(context)?.request_error ?? + "Poorly constructed query", + 406: AppLocalizations.of(context)?.incorrect_password ?? + "Incorrect password", + 404: AppLocalizations.of(context)?.unknown_user ?? "Unknown user", + 403: AppLocalizations.of(context)?.disabled_user ?? "Disabled user", + 410: AppLocalizations.of(context)?.invalid_token ?? "Invalid token", + 500: AppLocalizations.of(context)?.internal_error_server ?? + "Internal error server" }; - final text = errorMessages[responsePost.statusCode] ?? - "Problème d'authentification inconnu"; - showAlertDialog(context, "Erreur serveur", text); + final text = messages[responsePost.statusCode] ?? + AppLocalizations.of(context)?.unknown_error_auth ?? + "Unknown error auth"; + showAlertDialog( + context, AppLocalizations.of(context)?.error ?? "Error", text); } @override