diff --git a/Modules/AccountKit/Resources/Localizable.xcstrings b/Modules/AccountKit/Resources/Localizable.xcstrings index 06f190c775..6c764b3883 100644 --- a/Modules/AccountKit/Resources/Localizable.xcstrings +++ b/Modules/AccountKit/Resources/Localizable.xcstrings @@ -1,60 +1,78 @@ { - "version": "1.0", - "sourceLanguage": "en", - "strings": { - "accountkit.auth_manager.signup_failed_error": { - "comment": "Sign-up failure error message", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Sign-up failed. Please try again later." - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "L'inscription a \u00e9chou\u00e9. Veuillez r\u00e9essayer plus tard." - } - } - } + "sourceLanguage": "en", + "strings": { + "accountkit.auth_manager_view_model.verification_email_success_notification": { + "comment": "Verification email success notification message", + "extractionState": "extracted_with_value", + "localizations": { + "en": { + "stringUnit": { + "state": "new", + "value": "Verification email sent. Please check your inbox." + } }, - "accountkit.auth_manager.verification_email_failed_error": { - "comment": "Verification email failure error message", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "There was an error sending the verification email. Please try again later." - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "Une erreur s'est produite lors de l'envoi de l'e-mail de v\u00e9rification. Veuillez r\u00e9essayer plus tard." - } - } - } + "fr": { + "stringUnit": { + "state": "translated", + "value": "L'email de vérification a été envoyé. Veuillez vérifier votre boîte de réception." + } + } + } + }, + "accountkit.auth_manager.signup_failed_error": { + "comment": "Sign-up failure error message", + "extractionState": "extracted_with_value", + "localizations": { + "en": { + "stringUnit": { + "state": "new", + "value": "Sign-up failed. Please try again later." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "L'inscription a échoué. Veuillez réessayer plus tard." + } + } + } + }, + "accountkit.auth_manager.verification_email_failed_error": { + "comment": "Verification email failure error message", + "extractionState": "extracted_with_value", + "localizations": { + "en": { + "stringUnit": { + "state": "new", + "value": "There was an error sending the verification email. Please try again later." + } + }, + "fr": { + "stringUnit": { + "state": "translated", + "value": "Une erreur s'est produite lors de l'envoi de l'e-mail de vérification. Veuillez réessayer plus tard." + } + } + } + }, + "accountkit.auth_manager.signout_failed_error": { + "comment": "Sign-out failure error message", + "extractionState": "extracted_with_value", + "localizations": { + "en": { + "stringUnit": { + "state": "new", + "value": "Failed to sign out. Please try again." + } }, - "accountkit.auth_manager_view_model.verification_email_success_notification": { - "comment": "Verification email success notification message", - "extractionState": "extracted_with_value", - "localizations": { - "en": { - "stringUnit": { - "state": "new", - "value": "Verification email sent. Please check your inbox." - } - }, - "fr": { - "stringUnit": { - "state": "translated", - "value": "L'email de v\u00e9rification a \u00e9t\u00e9 envoy\u00e9. Veuillez v\u00e9rifier votre bo\u00eete de r\u00e9ception." - } - } - } + "fr": { + "stringUnit": { + "state": "translated", + "value": "La déconnexion a échoué. Veuillez réessayer." + } } + } } -} + }, + "version": "1.0" +} \ No newline at end of file diff --git a/Modules/AccountKit/Sources/Authentication/AccountManagerViewModel+l10n.swift b/Modules/AccountKit/Sources/Authentication/AccountManagerViewModel+l10n.swift deleted file mode 100644 index e2a5ab392a..0000000000 --- a/Modules/AccountKit/Sources/Authentication/AccountManagerViewModel+l10n.swift +++ /dev/null @@ -1,15 +0,0 @@ -// Leka - iOS Monorepo -// Copyright APF France handicap -// SPDX-License-Identifier: Apache-2.0 - -import LocalizationKit - -// swiftlint:disable line_length - -extension l10n { - enum AuthManagerViewModel { - static let signupFailedError = LocalizedString("accountkit.auth_manager_view_model.verification_email_success_notification", value: "Verification email sent. Please check your inbox.", comment: "Verification email success notification message") - } -} - -// swiftlint:enable line_length diff --git a/Modules/AccountKit/Sources/Authentication/AccountManager+l10n.swift b/Modules/AccountKit/Sources/Authentication/AuthManager+l10n.swift similarity index 75% rename from Modules/AccountKit/Sources/Authentication/AccountManager+l10n.swift rename to Modules/AccountKit/Sources/Authentication/AuthManager+l10n.swift index c31d31253e..850a7c579e 100644 --- a/Modules/AccountKit/Sources/Authentication/AccountManager+l10n.swift +++ b/Modules/AccountKit/Sources/Authentication/AuthManager+l10n.swift @@ -7,10 +7,12 @@ import LocalizationKit // swiftlint:disable line_length extension l10n { - enum AccountManager { + enum AuthManager { static let signupFailedError = LocalizedString("accountkit.auth_manager.signup_failed_error", value: "Sign-up failed. Please try again later.", comment: "Sign-up failure error message") static let verificationEmailFailure = LocalizedString("accountkit.auth_manager.verification_email_failed_error", value: "There was an error sending the verification email. Please try again later.", comment: "Verification email failure error message") + + static let signOutFailedError = LocalizedString("accountkit.auth_manager.signout_failed_error", value: "Failed to sign out. Please try again.", comment: "Sign-out failure error message") } } diff --git a/Modules/AccountKit/Sources/Authentication/AuthManager.swift b/Modules/AccountKit/Sources/Authentication/AuthManager.swift index 07c39dc601..4acadd9094 100644 --- a/Modules/AccountKit/Sources/Authentication/AuthManager.swift +++ b/Modules/AccountKit/Sources/Authentication/AuthManager.swift @@ -36,7 +36,7 @@ public class AuthManager { break case let .failure(error): log.error("\(error.localizedDescription)") - let errorMessage = "Sign-up failed. Please try again later." + let errorMessage = String(l10n.AuthManager.signupFailedError.characters) self?.authenticationError.send(AuthenticationError.custom(message: errorMessage)) } }, receiveValue: { [weak self] result in @@ -52,7 +52,7 @@ public class AuthManager { currentUser.sendEmailVerification { [weak self] error in if let error { log.error("\(error.localizedDescription)") - let errorMessage = "There was an error sending the verification email. Please try again later." + let errorMessage = String(l10n.AuthManager.verificationEmailFailure.characters) self?.authenticationError.send(AuthenticationError.custom(message: errorMessage)) return } @@ -63,10 +63,10 @@ public class AuthManager { do { try self.auth.signOut() self.authenticationState.send(.loggedOut) - log.notice("User was successfully signed out.") + log.info("User was successfully signed out.") } catch { log.error("Sign out failed: \(error.localizedDescription)") - let errorMessage = "Failed to sign out. Please try again." + let errorMessage = String(l10n.AuthManager.signOutFailedError.characters) self.authenticationError.send(AuthenticationError.custom(message: errorMessage)) } } diff --git a/Modules/AccountKit/Sources/Authentication/AuthManagerViewModel+l10n.swift b/Modules/AccountKit/Sources/Authentication/AuthManagerViewModel+l10n.swift new file mode 100644 index 0000000000..bd82e626ee --- /dev/null +++ b/Modules/AccountKit/Sources/Authentication/AuthManagerViewModel+l10n.swift @@ -0,0 +1,15 @@ +// Leka - iOS Monorepo +// Copyright APF France handicap +// SPDX-License-Identifier: Apache-2.0 + +import LocalizationKit + +// swiftlint:disable line_length + +extension l10n { + enum AuthManagerViewModel { + static let successfulEmailVerification = LocalizedString("accountkit.auth_manager_view_model.verification_email_success_notification", value: "Verification email sent. Please check your inbox.", comment: "Verification email success notification message") + } +} + +// swiftlint:enable line_length diff --git a/Modules/AccountKit/Sources/Authentication/AuthManagerViewModel.swift b/Modules/AccountKit/Sources/Authentication/AuthManagerViewModel.swift index ccfe32c695..e51152f5c4 100644 --- a/Modules/AccountKit/Sources/Authentication/AuthManagerViewModel.swift +++ b/Modules/AccountKit/Sources/Authentication/AuthManagerViewModel.swift @@ -58,7 +58,7 @@ public class AuthManagerViewModel: ObservableObject { switch state { case .loggedIn: if self.userIsSigningUp { - self.notificationMessage = "Verification email sent. Please check your inbox." + self.notificationMessage = String(l10n.AuthManagerViewModel.successfulEmailVerification.characters) self.showNotificationAlert = true } else { // Handle unverified Sign-in