Add localization to error messages

pull/23/head
Emre KARTAL 8 months ago
parent 75c966c1ec
commit 10c2ba3922

@ -23,6 +23,7 @@
"generic_add" = "Add";
"generic_delete" = "Delete";
"generic_stake" = "Stake";
"network_error_text" = "Make sure to be properly connected to the network then try again.";
/// Bet type
@ -30,6 +31,12 @@
"bet_type_match" = "Sport match";
"bet_type_custom" = "Custom answers";
/// Field error
"field_error_mandatory" = "This field is mandatory.";
"field_error_not_identical" = "The fields are not identical.";
"field_error_bad_email" = "Please enter a valid email.";
/// Drawer
"drawer_bets" = "Bets";
@ -62,16 +69,20 @@
"register_hello %@" = "Hello %@,";
"register_title" = "We need this!";
"register_subtitle" = "Don\'t worry it\'s fast.";
"register_error_title" = "Error saving";
"register_error_content" = "Registration failed. Try Again.";
"register_confirm_password" = "Confirm password";
"register_already_used" = "Email or nickname already used.";
/// Login Page
"login_title" = "Welcome back !";
"login_subtitle" = "We missed you.";
"login_error_title" = "Connection error";
"login_error_content" = "Failed to login\nPlease try again.";
"login_error_content" = "Failed to login. Please try again.";
"login_no_account" = "Don't have an account ?";
"login_forgot_password" = "Forgot password ?";
"login_bad_credentials" = "Incorrect login or password.";
/// Bet Creation Page
@ -100,9 +111,12 @@
"bet_creation_yes_no_bottom_text_2" = "No other answer will be accepted.";
"bet_creation_custom_bottom_text_1" = "You are going to fill in the different answers available in this bet.";
"bet_creation_custom_bottom_text_2" = "Be careful to be clear and avoid any uncertainties";
"bet_creation_error" = "Error while creating the bet. Please try again.";
"bet_creation_error" = "Error while creating the bet.";
"bet_creation_success_message" = "Bet created !";
"bet_creation_response_title" = "Response title";
"bet_creation_max_answers %lld" = "%lld more max.";
"bet_creation_error_past_date" = "The registration end date must be later than the current date.";
"bet_creation_error_date_order" = "The betting end date must be later than the registration end date.";
/// Bet page
@ -156,3 +170,8 @@
"daily_reward_title" = "Daily reward";
"daily_reward_subtitle" = "Your daily reward is unlocked every day at 00:00 UTC and allows you to get between 10 and 150 Allcoins.";
/// Notification
"notification_title_end_bet_date" = "Who will be the winners?";
"notification_subtitle_end_bet_date %@" = "The %@ bet has reached its deadline. Go to the app to enter the winning answer.";

@ -23,6 +23,7 @@
"generic_add" = "Ajouter";
"generic_delete" = "Supprimer";
"generic_stake" = "Mise";
"network_error_text" = "Assurez-vous d\'être bien connecté au réseau puis réessayez.";
/// Bet type
@ -30,6 +31,12 @@
"bet_type_match" = "Match sportif";
"bet_type_custom" = "Réponses personnalisées";
/// Field error
"field_error_mandatory" = "Ce champ est obligatoire.";
"field_error_not_identical" = "Les champs ne sont pas identiques.";
"field_error_bad_email" = "Veuillez saisir un email valide.";
/// Drawer
"drawer_bets" = "Bets";
@ -62,16 +69,20 @@
"register_hello %@" = "Bonjour %@,";
"register_title" = "On a besoins de ça!";
"register_subtitle" = "Promis c\'est rapide.";
"register_error_title" = "Erreur lors de l'enregistrement";
"register_error_content" = "L'enregistrement a échoué. Veuillez réessayer.";
"register_confirm_password" = "Confirmation du mot de passe";
"register_already_used" = "Email ou pseudo déjà utilisé.";
/// Login Page
"login_title" = "Te revoilà !";
"login_subtitle" = "Bon retour parmis nous tu nous as manqué !";
"login_error_title" = "Erreur de connexion";
"login_error_content" = "La connexion a échoué\nVeuillez réessayer.";
"login_error_content" = "La connexion a échoué. Veuillez réessayer.";
"login_no_account" = "Pas encore inscrit ?";
"login_forgot_password" = "Mot de passe oublié ?";
"login_bad_credentials" = "Login ou mot de passe incorrects.";
/// Bet Creation Page
@ -100,9 +111,12 @@
"bet_creation_yes_no_bottom_text_2" = "Aucune autre réponse ne sera acceptée.";
"bet_creation_custom_bottom_text_1" = "Vous allez renseigner les différentes réponses disponibles dans ce pari.";
"bet_creation_custom_bottom_text_2" = "Faites attention a etre claire et éviter toutes incertitudes";
"bet_creation_error" = "Erreur lors de la création du bet, veuillez rééssayer.";
"bet_creation_error" = "Erreur lors de la création du bet.";
"bet_creation_success_message" = "Bet créé !";
"bet_creation_response_title" = "Intitulé de réponse";
"bet_creation_max_answers %lld" = "encore %lld max.";
"bet_creation_error_past_date" = "La date de fin des inscriptions doit être ultérieure à la date actuelle.";
"bet_creation_error_date_order" = "La date de fin des paris doit être ultérieure à la date de fin des inscriptions.";
/// Bet page
@ -156,3 +170,8 @@
"daily_reward_title" = "Récompense quotidienne";
"daily_reward_subtitle" = "Votre récompense quotidienne est débloquée tous les jours à 00:00 UTC et vous permets dobtenir entre 10 et 150 Allcoins.";
/// Notification
"notification_title_end_bet_date" = "Qui seront les vainqueurs ?";
"notification_subtitle_end_bet_date %@" = "Le pari %@ a atteint sa date limite. Rendez-vous dans l'application pour renseigner la réponse gagnante.";

@ -42,11 +42,11 @@ class CreationBetViewModel: ObservableObject {
switch statusCode {
case 201:
self.betAdded = true
let notificationItem = NotificationItem(title: "Qui seront les vainqueurs ?", content: "Le pari \"\(self.theme)\" a atteint sa date limite. Rendez-vous dans l'application pour renseigner la réponse gagnante.", interval: self.endBetDate.timeIntervalSinceNow)
let notificationItem = NotificationItem(title: String(localized: "notification_title_end_bet_date"), content: String(localized: "notification_subtitle_end_bet_date \(self.theme)"), interval: self.endBetDate.timeIntervalSinceNow)
AppStateContainer.shared.notificationState.scheduleNotification(with: notificationItem)
default:
self.setErrorMessage(errorMessage: "Problème de connexion. Veuillez réessayer ultérieurement.")
self.setErrorMessage(errorMessage: String(localized: "network_error_text"))
}
}
}
@ -63,25 +63,25 @@ class CreationBetViewModel: ObservableObject {
// Theme
if checkTheme, theme.isEmpty {
newThemeFieldError = "Veuillez saisir le thème."
newThemeFieldError = String(localized: "field_error_mandatory")
hasError = true
}
// Description
if checkDescription, description.isEmpty {
newDescriptionFieldError = "Veuillez saisir la description."
newDescriptionFieldError = String(localized: "field_error_mandatory")
hasError = true
}
// End Register Date
if checkEndRegisterDate, endRegisterDate < Date() {
newEndRegisterDateFieldError = "La date de fin des inscriptions doit être ultérieure à la date actuelle."
newEndRegisterDateFieldError = String(localized: "bet_creation_error_past_date")
hasError = true
}
// End Bet Date
if checkEndBetDate, endBetDate < endRegisterDate {
newEndBetDateFieldError = "La date de fin des paris doit être ultérieure à la date de fin des inscriptions."
newEndBetDateFieldError = String(localized: "bet_creation_error_date_order")
hasError = true
}

@ -36,10 +36,10 @@ class LoginViewModel: ObservableObject {
self.onLoginSuccess()
case 404:
AppStateContainer.shared.loggedState.connectedUser = false
self.setErrorMessage(errorMessage: "Login ou mot de passe incorrects.")
self.setErrorMessage(errorMessage: String(localized: "login_bad_credentials"))
default:
AppStateContainer.shared.loggedState.connectedUser = false
self.setErrorMessage(errorMessage: "La connexion a échoué. Veuillez réessayer.")
self.setErrorMessage(errorMessage: String(localized: "login_error_content"))
}
}
}
@ -55,13 +55,13 @@ class LoginViewModel: ObservableObject {
// Login
if checkLogin, loginIdentifier.isEmpty {
newLoginIdentifierFieldError = "Veuillez saisir votre identifiant."
newLoginIdentifierFieldError = String(localized: "field_error_mandatory")
hasError = true
}
// Password
if checkPassword, loginPassword.isEmpty {
newLoginPasswordFieldError = "Veuillez saisir votre mot de passe."
newLoginPasswordFieldError = String(localized: "field_error_mandatory")
hasError = true
}

@ -40,10 +40,10 @@ class RegisterViewModel: ObservableObject {
self.onRegisterSuccess()
case 409:
AppStateContainer.shared.loggedState.connectedUser = false
self.setErrorMessage(errorMessage: "Email ou pseudo déjà utilisé.")
self.setErrorMessage(errorMessage: String(localized: "register_already_used"))
default:
AppStateContainer.shared.loggedState.connectedUser = false
self.setErrorMessage(errorMessage: "La connexion a échoué. Veuillez réessayer.")
self.setErrorMessage(errorMessage: String(localized: "register_error_content"))
}
}
}
@ -61,35 +61,33 @@ class RegisterViewModel: ObservableObject {
// Username
if checkUsername, registerUsername.isEmpty {
newRegisterUsernameFieldError = "Veuillez saisir votre pseudo."
newRegisterUsernameFieldError = String(localized: "field_error_mandatory")
hasError = true
}
// Email
if checkEmail, registerEmail.isEmpty {
newRegisterEmailFieldError = "Veuillez saisir votre email."
newRegisterEmailFieldError = String(localized: "field_error_mandatory")
hasError = true
}
if checkEmail, isValidEmail(email: registerEmail) {
newRegisterEmailFieldError = "Veuillez saisir un email valide."
} else if checkEmail, isValidEmail(email: registerEmail) {
newRegisterEmailFieldError = String(localized: "field_error_bad_email")
hasError = true
}
// Password
if checkPassword, registerPassword.isEmpty {
newRegisterPasswordFieldError = "Veuillez saisir votre mot de passe."
newRegisterPasswordFieldError = String(localized: "field_error_mandatory")
hasError = true
}
// Confirm password
if checkConfirmPassword, registerConfirmPassword.isEmpty {
newRegisterConfirmPasswordFieldError = "Veuillez confirmer votre mot de passe."
newRegisterConfirmPasswordFieldError = String(localized: "field_error_mandatory")
hasError = true
}
if checkConfirmPassword, registerConfirmPassword != registerPassword {
newRegisterConfirmPasswordFieldError = "Les mots de passe ne sont pas identiques."
newRegisterConfirmPasswordFieldError = String(localized: "field_error_not_identical")
hasError = true
}

@ -423,7 +423,7 @@ struct CreationBetView: View {
}
HStack {
Spacer()
Text("encore \(5 - values.count) max.")
Text(String(localized: "bet_creation_max_answers \(5 - values.count)"))
.textStyle(weight: .regular, color: AllInColors.primaryTextColor, size: 12)
}
@ -497,7 +497,7 @@ struct CreationBetView: View {
hideKeyboard()
}
.alert(isPresented: $viewModel.showErrorMessage) {
Alert(title: Text("Erreur lors de la création d'un Bet"), message: Text(viewModel.errorMessage ?? ""), dismissButton: .default(Text("generic_ok")))
Alert(title: Text("bet_creation_error"), message: Text(viewModel.errorMessage ?? ""), dismissButton: .default(Text("generic_ok")))
}
.edgesIgnoringSafeArea(.bottom)
.background(AllInColors.backgroundColor)

@ -217,7 +217,7 @@ struct RegisterView: View {
}
.alert(isPresented: $viewModel.showErrorMessage) {
Alert(title: Text("Erreur lors de l'enregistrement"), message: Text(viewModel.errorMessage ?? ""), dismissButton: .default(Text("generic_ok")))
Alert(title: Text("register_error_title"), message: Text(viewModel.errorMessage ?? ""), dismissButton: .default(Text("generic_ok")))
}
.background(AllInColors.startBackgroundColor)
.onSubmit {

Loading…
Cancel
Save