3 Commits

3 changed files with 31 additions and 10 deletions

View File

@@ -26,5 +26,12 @@
"create": "Creation", "create": "Creation",
"user_create": "Your user created", "user_create": "Your user created",
"request_error": "Poorly constructed query", "request_error": "Poorly constructed query",
"incorrect_password": "Incorrect password" "incorrect_password": "Incorrect password",
"unknown_user": "Unknown user",
"disabled_user": "User disabled",
"invalid_token": "Invalid token",
"internal_error_server": "Internal error server",
"unknown_error_auth": "Unknown error authentification",
"required_input": "Required input",
"create_profile": "Create profile"
} }

View File

@@ -26,5 +26,13 @@
"create": "Création", "create": "Création",
"user_create": "Votre utilisateur a été créé", "user_create": "Votre utilisateur a été créé",
"request_error": "Requête mal construite", "request_error": "Requête mal construite",
"incorrect_password": "Mot de passe incorrect" "incorrect_password": "Mot de passe incorrect",
"unknown_user": "Utilisateur inconnu",
"disabled_user": "Utilisateur désactivé",
"invalid_token": "Token invalide",
"internal_error_server": "Erreur interne de serveur",
"unknown_error_auth": "Problème d'authentification inconnu",
"required_input": "Champ requis",
"create_profile": "Creation profil"
} }

View File

@@ -139,15 +139,18 @@ class _AddProfileState extends State<AddProfile> with ShowAlertDialog {
"Poorly constructed query", "Poorly constructed query",
406: AppLocalizations.of(context)?.incorrect_password ?? 406: AppLocalizations.of(context)?.incorrect_password ??
"Incorrect password", "Incorrect password",
404: "Utilisateur inconnu", 404: AppLocalizations.of(context)?.unknown_user ?? "Unknown user",
403: "Utilisateur désactivé", 403: AppLocalizations.of(context)?.disabled_user ?? "Disabled user",
410: "Token invalide", 410: AppLocalizations.of(context)?.invalid_token ?? "Invalid token",
500: "Problème interne du serveur", 500: AppLocalizations.of(context)?.internal_error_server ??
"Internal error server"
}; };
final text = errorMessages[responsePost.statusCode] ?? final text = errorMessages[responsePost.statusCode] ??
"Problème d'authentification inconnu"; AppLocalizations.of(context)?.unknown_error_auth ??
showAlertDialog(context, "Erreur serveur", text); "Unknown error auth";
showAlertDialog(
context, AppLocalizations.of(context)?.error ?? "Error", text);
} }
@override @override
@@ -163,7 +166,9 @@ class _AddProfileState extends State<AddProfile> with ShowAlertDialog {
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;
} }
@override @override
@@ -171,7 +176,8 @@ class _AddProfileState extends State<AddProfile> with ShowAlertDialog {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: AppBar( appBar: AppBar(
title: Text("Create profile"), title: Text(
AppLocalizations.of(context)?.create_profile ?? "Create profile"),
backgroundColor: Colors.blue, backgroundColor: Colors.blue,
foregroundColor: Colors.white, foregroundColor: Colors.white,
), ),