Fixed the localisation of the error messages in the LoginView view.

This commit is contained in:
Javier Cicchelli 2022-12-11 22:09:39 +01:00
parent 342658e3f7
commit c9468a6a68
3 changed files with 15 additions and 7 deletions

View File

@ -11,5 +11,5 @@
"login.text_field.password.placeholder" = "Password";
"login.button.log_in.text" = "Log in";
"login.error.authentication_failed.text" = "The provided username and/or password are incorrect.\nPlease try again.";
"login.error.unknown.text" = "An unexpected error occurred while trying to authenticate your credentials.\nPlease try again at a later time.";
"login.error.authentication_failed.text" = "The given username and/or password are not correct.\nPlease re-enter your credentials and try again.";
"login.error.authentication_unknown.text" = "An unexpected error occurred while trying to authenticate your credentials.\nPlease try again at a later time.";

View File

@ -76,9 +76,17 @@ struct LoginForm: View {
if let errorMessage {
Divider()
Text(errorMessage)
.font(.body)
.foregroundColor(.red)
Text(
NSLocalizedString(
errorMessage,
bundle: .module,
comment: "The error message received from the backend."
)
)
.font(.body)
.foregroundColor(.red)
.frame(maxWidth: .infinity)
.multilineTextAlignment(.center)
}
}
.frame(maxWidth: .infinity, alignment: .leading)

View File

@ -142,10 +142,10 @@ private extension LoginView.LoginContainer {
password: password
)
} catch APIClientError.authenticationFailed {
errorMessage = .init(localized: "login.error.authentication_failed.text")
errorMessage = "login.error.authentication_failed.text"
isAuthenticating = false
} catch {
errorMessage = .init(localized: "login.error.unknown.text")
errorMessage = "login.error.authentication_unknown.text"
isAuthenticating = false
}
}