diff --git a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Strings/Localizable.xcstrings b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Strings/Localizable.xcstrings index 55ffb43c9f..ce1a25b183 100644 --- a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Strings/Localizable.xcstrings +++ b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Strings/Localizable.xcstrings @@ -1,6 +1,9 @@ { "sourceLanguage" : "en", "strings" : { + "%@" : { + + }, "AccountDisabledError" : { "comment" : "Error message displayed when the account is disabled. Use short/abbreviated translation for 'email' which is less than 15 chars.", "extractionState" : "migrated", @@ -250,6 +253,18 @@ } } }, + "ConfirmPasswordInputLabel" : { + "comment" : "Input label for confirming password when signing up", + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Confirm Password" + } + } + } + }, "Delete" : { "comment" : "Text of Delete action button.", "extractionState" : "manual", @@ -261,9 +276,6 @@ } } } - }, - "Delete account" : { - }, "DeleteAccountBody" : { "comment" : "Alert message body shown to confirm account deletion action.", @@ -317,7 +329,14 @@ }, "Don't have an account yet?" : { - + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Don't have an account yet?" + } + } + } }, "EditEmailTitle" : { "comment" : "Controller title shown when editing account email. Use short/abbreviated translation for 'email' which is less than 15 chars.", @@ -367,9 +386,6 @@ } } }, - "Email" : { - "comment" : "Label next to a email text field. Use short/abbreviated translation for 'email' which is less than 15 chars." - }, "EmailAlreadyInUseError" : { "comment" : "Error message displayed when the email address is already in use. Use short/abbreviated translation for 'email' which is less than 15 chars.", "extractionState" : "migrated", @@ -382,6 +398,30 @@ } } }, + "EmailLinkSignInLabel" : { + "comment" : "Button label to push user to email link sign-in", + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Prefer Email link sign-in?" + } + } + } + }, + "EmailLinkSignInTitle" : { + "comment" : "Sign in with email link View title", + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Sign in with email link" + } + } + } + }, "EmailsDontMatch" : { "comment" : "Error message displayed when after re-authorization current user's email and re-authorized user's email doesn't match. Use short/abbreviated translation for 'email' which is less than 15 chars.", "extractionState" : "manual", @@ -405,9 +445,6 @@ } } } - }, - "Enter Password" : { - }, "EnterYourEmail" : { "comment" : "Title for email entry screen, email text field placeholder. Use short/abbreviated translation for 'email' which is less than 15 chars.", @@ -492,9 +529,6 @@ } } } - }, - "Forgotten Password?" : { - }, "Instructions" : { @@ -525,12 +559,16 @@ }, "Log in" : { - }, - "Log in with password" : { - }, "Login" : { - + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Login" + } + } + } }, "Name" : { "comment" : "Label next to a name text field.", @@ -569,9 +607,6 @@ } }, "Password" : { - "comment" : "Label next to a password text field." - }, - "Password Recovery" : { }, "PasswordRecoveryEmailSentMessage" : { @@ -693,18 +728,9 @@ } } } - }, - "Please check your email for email sign-in link." : { - - }, - "Please check your email for password recovery instructions." : { - }, "Please check your email for verification link." : { - }, - "Prefer Email link sign-in?" : { - }, "PrivacyPolicy" : { "comment" : "Text linked to a web page with the Privacy Policy content.", @@ -826,20 +852,20 @@ } } }, - "Send email sign-in link" : { - - }, - "Sign in with email link" : { - - }, - "Sign out" : { - + "SendEmailSignInLinkButtonLabel" : { + "comment" : "Button label for sending email sign-in link", + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Send email sign-in link" + } + } + } }, "Sign up" : { - }, - "Signed in" : { - }, "SignedIn" : { "comment" : "Title of successfully signed in label.", @@ -936,9 +962,6 @@ } } } - }, - "Submit" : { - }, "TermsOfService" : { "comment" : "Text linked to a web page with the Terms of Service content.", @@ -1049,7 +1072,15 @@ } }, "Update password" : { - + "comment" : "Update password button label", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Update password" + } + } + } }, "UpdateEmailAlertMessage" : { "comment" : "Alert action message shown before updating email action. Use short/abbreviated translation for 'email' which is less than 15 chars.", @@ -1074,9 +1105,6 @@ } } } - }, - "User: %@" : { - }, "UserNotFoundError" : { "comment" : "Error message displayed when there's no account matching the email address. Use short/abbreviated translation for 'email' which is less than 15 chars.", @@ -1091,7 +1119,15 @@ } }, "Verify email address?" : { - + "comment" : "Label for sending email verification to user.", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Verify email address?" + } + } + } }, "VerifyItsYou" : { "comment" : "Alert message title show for re-authorization.", diff --git a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Utils/StringUtils.swift b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Utils/StringUtils.swift index 3bcb9ca738..170632b512 100644 --- a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Utils/StringUtils.swift +++ b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Utils/StringUtils.swift @@ -3,23 +3,13 @@ import SwiftUI let kKeyNotFound = "Key not found" -let kUsersNotFoundError = "UserNotFoundError" -let kEmailAlreadyInUseError = "EmailAlreadyInUseError" -let kInvalidEmailError = "InvalidEmailError" -let kWeakPasswordError = "WeakPasswordError" -let kSignUpTooManyTimesError = "SignUpTooManyTimesError" -let kWrongPasswordError = "WrongPasswordError" -let kAccountDisabledError = "AccountDisabledError" -let kEmailsDoNotMatchError = "EmailsDoNotMatchError" -let kUnknownError = "UnknownError" - public class StringUtils { let bundle: Bundle init(bundle: Bundle) { self.bundle = bundle } - public func localizedString(forKey key: String) -> String { + public func localizedString(for key: String) -> String { let keyLocale = String.LocalizationValue(key) let value = String(localized: keyLocale, bundle: bundle) return value @@ -31,30 +21,310 @@ public class StringUtils { switch errorCode { case .emailAlreadyInUse: return localizedString( - forKey: kEmailAlreadyInUseError + for: "EmailAlreadyInUseError" ) case .invalidEmail: - return localizedString(forKey: kInvalidEmailError) + return localizedString(for: "InvalidEmailError") case .weakPassword: - return localizedString(forKey: kWeakPasswordError) + return localizedString(for: "WeakPasswordError") case .tooManyRequests: return localizedString( - forKey: kSignUpTooManyTimesError + for: "SignUpTooManyTimesError" ) case .wrongPassword: return localizedString( - forKey: kWrongPasswordError + for: "WrongPasswordError" ) case .userNotFound: return localizedString( - forKey: kUsersNotFoundError + for: "UserNotFoundError" ) case .userDisabled: return localizedString( - forKey: kAccountDisabledError + for: "AccountDisabledError" ) default: return error.localizedDescription } } + + /// Auth Picker title + /// found in: + /// - AuthPickerView + public var authPickerTitle: String { + return localizedString(for: "AuthPickerTitle") + } + + /// Email input label + /// found in: + /// - EmailAuthView + /// - PasswordRecoveryView + /// - EmailLinkView + public var emailInputLabel: String { + return localizedString(for: "EnterYourEmail") + } + + /// Password button action label + /// found in: + /// - EmailAuthView + public var passwordButtonLabel: String { + return localizedString(for: "ForgotPasswordTitle") + } + + /// Password input label + /// found in: + /// - EmailAuthView + /// - PasswordPromptView + /// - UpdatePassword + public var passwordInputLabel: String { + return localizedString(for: "EnterYourPassword") + } + + /// Password recovery title + /// found in: + /// - PasswordRecoveryView + public var passwordRecoveryTitle: String { + return localizedString(for: "PasswordRecoveryTitle") + } + + /// Password recovery email sent title + /// found in: + /// - PasswordRecoveryView + public var passwordRecoveryEmailSentTitle: String { + return localizedString(for: "PasswordRecoveryEmailSentTitle") + } + + /// Password recovery helper message + /// found in: + /// - PasswordRecoveryView + public var passwordRecoveryHelperMessage: String { + return localizedString(for: "PasswordRecoveryMessage") + } + + /// Password recovery email sent message + /// found in: + /// - PasswordRecoveryView + public var passwordRecoveryEmailSentMessage: String { + return localizedString(for: "PasswordRecoveryEmailSentMessage") + } + + /// Forgot password input label + /// found in: + /// - PasswordRecoveryView + public var forgotPasswordInputLabel: String { + return localizedString(for: "ForgotPassword") + } + + /// Signed in title + /// found in: + /// - SignedInView + public var signedInTitle: String { + return localizedString(for: "SignedIn") + } + + /// Confirm password + /// found in: + /// - EmailAuthView + /// - UpdatePassword + public var confirmPasswordInputLabel: String { + return localizedString(for: "ConfirmPasswordInputLabel") + } + + /// Sign in with email button label or can be used as title + /// found in: + /// - EmailAuthView + public var signInWithEmailButtonLabel: String { + return localizedString(for: "SignInWithEmail") + } + + /// Sign up with email button label + /// found in: + /// - EmailAuthView + public var signUpWithEmailButtonLabel: String { + return localizedString(for: "SignUpTitle") + } + + /// Sign-in with email link button label to push user to email link view + /// found in: + /// - EmailAuthView + public var signUpWithEmailLinkButtonLabel: String { + return localizedString(for: "EmailLinkSignInLabel") + } + + /// send email link sign-in button label + /// found in: + /// - EmailLinkView + public var sendEmailLinkButtonLabel: String { + return localizedString(for: "SendEmailSignInLinkButtonLabel") + } + + /// Sign in with email link View title + /// found in: + /// - EmailLinkView + public var signInWithEmailLinkViewTitle: String { + return localizedString(for: "EmailLinkSignInTitle") + } + + /// Sign in with email link View message + /// found in: + /// - EmailLinkView + public var signInWithEmailLinkViewMessage: String { + return localizedString(for: "SignInEmailSent") + } + + /// Account settings - Delete button label + /// found in: + /// - SignedInView + public var deleteAccountButtonLabel: String { + return localizedString(for: "AS_DeleteAccount") + } + + /// Account settings - Email label + /// found in: + /// SignedInView + public var accountSettingsEmailLabel: String { + return localizedString(for: "AS_Email") + } + + /// Account settings - sign out button label + /// found in: + /// - SignedInView + public var signOutButtonLabel: String { + return localizedString(for: "AS_SignOut") + } + + /// Account settings - update password button label + /// found in: + /// - SignedInView + /// - UpdatePassword + public var updatePasswordButtonLabel: String { + return localizedString(for: "Update password") + } + + /// Account settings - send email verification label + /// found in: + /// VerifyEmailView + public var sendEmailVerificationButtonLabel: String { + return localizedString(for: "Verify email address?") + } + + /// Account settings - verify email sheet message + /// found in: + /// VerifyEmailView + public var verifyEmailSheetMessage: String { + return localizedString(for: "Verification email sent") + } + + /// General string - Back button label + /// found in: + /// - PasswordRecoveryView + /// - EmailLinkView + public var backButtonLabel: String { + return localizedString(for: "Back") + } + + /// General string - OK button label + /// found in: + /// - PasswordRecoveryView + /// - EmailLinkView + /// - PasswordPromptView + public var okButtonLabel: String { + return localizedString(for: "OK") + } + + /// General string - Cancel button label + /// found in: + /// - PasswordPromptView + public var cancelButtonLabel: String { + return localizedString(for: "Cancel") + } + + /// Email provider + /// found in: + /// - AuthPickerView + public var emailLoginFlowLabel: String { + return localizedString(for: "Login") + } + + /// Email provider + /// found in: + /// - AuthPickerView + public var emailSignUpFlowLabel: String { + return localizedString(for: "Sign up") + } + + /// Email provider + /// found in: + /// - AuthPickerView + public var dontHaveAnAccountYetLabel: String { + return localizedString(for: "Don't have an account yet?") + } + + /// Email provider + /// found in: + /// - AuthPickerView + public var alreadyHaveAnAccountLabel: String { + return localizedString(for: "Already have an account?") + } + + /// Facebook provider + /// found in: + /// - SignInWithFacebookButton + public var facebookLoginButtonLabel: String { + return localizedString(for: "Continue with Facebook") + } + + /// Facebook provider + /// found in: + /// - SignInWithFacebookButton + public var facebookLoginCancelledLabel: String { + return localizedString(for: "Facebook login cancelled") + } + + /// Facebook provider + /// found in: + /// - SignInWithFacebookButton + public var authorizeUserTrackingLabel: String { + return localizedString(for: "Authorize User Tracking") + } + + /// Facebook provider + /// found in: + /// - SignInWithFacebookButton + public var facebookLimitedLoginLabel: String { + return localizedString(for: "Limited Login") + } + + /// Facebook provider + /// found in: + /// - SignInWithFacebookButton + public var facebookAuthorizeUserTrackingMessage: String { + return localizedString(for: "For classic Facebook login, please authorize user tracking.") + } + + /// Phone provider + /// found in: + /// - PhoneAuthButtonView + public var enterPhoneNumberLabel: String { + return localizedString(for: "Enter phone number") + } + /// Phone provider + /// found in: + /// - PhoneAuthButtonView + public var phoneNumberVerificationCodeLabel: String { + return localizedString(for: "Enter verification code") + } + /// Phone provider + /// found in: + /// - PhoneAuthButtonView + public var smsCodeSentLabel: String { + return localizedString(for: "SMS code sent") + } + + /// Phone provider + /// found in: + /// - PhoneAuthButtonView + public var verifyPhoneNumberAndSignInLabel: String { + return localizedString(for: "Verify phone number and sign-in") + } } diff --git a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/AuthPickerView.swift b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/AuthPickerView.swift index 0d1d84fbac..232e853aef 100644 --- a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/AuthPickerView.swift +++ b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/AuthPickerView.swift @@ -18,6 +18,10 @@ public struct AuthPickerView { extension AuthPickerView: View { public var body: some View { VStack { + Text(authService.string.authPickerTitle) + .font(.largeTitle) + .fontWeight(.bold) + .padding() if authService.authenticationState == .authenticated { SignedInView() } else if authService.authView == .passwordRecovery { @@ -25,21 +29,23 @@ extension AuthPickerView: View { } else if authService.authView == .emailLink { EmailLinkView() } else { - Text(authService.authenticationFlow == .login ? "Login" : "Sign up") + Text(authService.authenticationFlow == .login ? authService.string + .emailLoginFlowLabel : authService.string.emailSignUpFlowLabel) VStack { Divider() } EmailAuthView() authService.renderButtons() VStack { Divider() } HStack { Text(authService - .authenticationFlow == .login ? "Don't have an account yet?" : - "Already have an account?") + .authenticationFlow == .login ? authService.string.dontHaveAnAccountYetLabel : + authService.string.alreadyHaveAnAccountLabel) Button(action: { withAnimation { switchFlow() } }) { - Text(authService.authenticationFlow == .signUp ? "Log in" : "Sign up") + Text(authService.authenticationFlow == .signUp ? authService.string + .emailLoginFlowLabel : authService.string.emailSignUpFlowLabel) .fontWeight(.semibold) .foregroundColor(.blue) } diff --git a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/EmailAuthView.swift b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/EmailAuthView.swift index 1e7c3c3caa..02bb970749 100644 --- a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/EmailAuthView.swift +++ b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/EmailAuthView.swift @@ -51,7 +51,7 @@ extension EmailAuthView: View { public var body: some View { VStack { LabeledContent { - TextField("Email", text: $email) + TextField(authService.string.emailInputLabel, text: $email) .textInputAutocapitalization(.never) .disableAutocorrection(true) .focused($focus, equals: .email) @@ -67,7 +67,7 @@ extension EmailAuthView: View { .padding(.bottom, 4) LabeledContent { - SecureField("Password", text: $password) + SecureField(authService.string.passwordInputLabel, text: $password) .focused($focus, equals: .password) .submitLabel(.go) .onSubmit { @@ -84,13 +84,13 @@ extension EmailAuthView: View { Button(action: { authService.authView = .passwordRecovery }) { - Text("Forgotten Password?") + Text(authService.string.passwordButtonLabel) } } if authService.authenticationFlow == .signUp { LabeledContent { - SecureField("Confirm password", text: $confirmPassword) + SecureField(authService.string.confirmPasswordInputLabel, text: $confirmPassword) .focused($focus, equals: .confirmPassword) .submitLabel(.go) .onSubmit { @@ -111,7 +111,8 @@ extension EmailAuthView: View { } }) { if authService.authenticationState != .authenticating { - Text(authService.authenticationFlow == .login ? "Log in with password" : "Sign up") + Text(authService.authenticationFlow == .login ? authService.string + .signInWithEmailButtonLabel : authService.string.signUpWithEmailButtonLabel) .padding(.vertical, 8) .frame(maxWidth: .infinity) } else { @@ -128,7 +129,7 @@ extension EmailAuthView: View { Button(action: { authService.authView = .passwordRecovery }) { - Text("Prefer Email link sign-in?") + Text(authService.string.signUpWithEmailLinkButtonLabel) } } } diff --git a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/EmailLinkView.swift b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/EmailLinkView.swift index 321b492c7b..1bd38d2e1a 100644 --- a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/EmailLinkView.swift +++ b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/EmailLinkView.swift @@ -20,9 +20,9 @@ public struct EmailLinkView { extension EmailLinkView: View { public var body: some View { VStack { - Text("Sign in with email link") + Text(authService.string.signInWithEmailLinkViewTitle) LabeledContent { - TextField("Email", text: $email) + TextField(authService.string.emailInputLabel, text: $email) .textInputAutocapitalization(.never) .disableAutocorrection(true) .submitLabel(.next) @@ -37,7 +37,7 @@ extension EmailLinkView: View { authService.emailLink = email } }) { - Text("Send email sign-in link") + Text(authService.string.sendEmailLinkButtonLabel) .padding(.vertical, 8) .frame(maxWidth: .infinity) } @@ -48,11 +48,9 @@ extension EmailLinkView: View { Text(authService.errorMessage).foregroundColor(.red) }.sheet(isPresented: $showModal) { VStack { - Text("Instructions") - .font(.headline) - Text("Please check your email for email sign-in link.") + Text(authService.string.signInWithEmailLinkViewMessage) .padding() - Button("Dismiss") { + Button(authService.string.okButtonLabel) { showModal = false } .padding() @@ -70,7 +68,7 @@ extension EmailLinkView: View { }) { Image(systemName: "chevron.left") .foregroundColor(.blue) - Text("Back") + Text(authService.string.backButtonLabel) .foregroundColor(.blue) }) } diff --git a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/PasswordPromptView.swift b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/PasswordPromptView.swift index 6a4db96bb2..c306d2f433 100644 --- a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/PasswordPromptView.swift +++ b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/PasswordPromptView.swift @@ -1,6 +1,7 @@ import SwiftUI struct PasswordPromptSheet { + @Environment(AuthService.self) private var authService @Bindable var coordinator: PasswordPromptCoordinator @State private var password = "" } @@ -8,16 +9,16 @@ struct PasswordPromptSheet { extension PasswordPromptSheet: View { var body: some View { VStack(spacing: 20) { - SecureField("Enter Password", text: $password) + SecureField(authService.string.passwordInputLabel, text: $password) .textFieldStyle(.roundedBorder) .padding() HStack { - Button("Cancel") { + Button(authService.string.cancelButtonLabel) { coordinator.cancel() } Spacer() - Button("Submit") { + Button(authService.string.okButtonLabel) { coordinator.submit(password: password) } .disabled(password.isEmpty) diff --git a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/PasswordRecoveryView.swift b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/PasswordRecoveryView.swift index b237526aca..c29e157ee6 100644 --- a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/PasswordRecoveryView.swift +++ b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/PasswordRecoveryView.swift @@ -19,9 +19,15 @@ public struct PasswordRecoveryView { extension PasswordRecoveryView: View { public var body: some View { VStack { - Text("Password Recovery") + Text(authService.string.passwordRecoveryTitle) + .font(.largeTitle) + .fontWeight(.bold) + .padding() + + Divider() + LabeledContent { - TextField("Email", text: $email) + TextField(authService.string.emailInputLabel, text: $email) .textInputAutocapitalization(.never) .disableAutocorrection(true) .submitLabel(.next) @@ -35,7 +41,7 @@ extension PasswordRecoveryView: View { await sendPasswordRecoveryEmail() } }) { - Text("Password Recovery") + Text(authService.string.forgotPasswordInputLabel) .padding(.vertical, 8) .frame(maxWidth: .infinity) } @@ -45,11 +51,18 @@ extension PasswordRecoveryView: View { .buttonStyle(.borderedProminent) }.sheet(isPresented: $showModal) { VStack { - Text("Instructions") - .font(.headline) - Text("Please check your email for password recovery instructions.") + Text(authService.string.passwordRecoveryEmailSentTitle) + .font(.largeTitle) + .fontWeight(.bold) + .padding() + Text(authService.string.passwordRecoveryHelperMessage) + .padding() + + Divider() + + Text(authService.string.passwordRecoveryEmailSentMessage) .padding() - Button("Dismiss") { + Button(authService.string.okButtonLabel) { showModal = false } .padding() @@ -63,7 +76,7 @@ extension PasswordRecoveryView: View { }) { Image(systemName: "chevron.left") .foregroundColor(.blue) - Text("Back") + Text(authService.string.backButtonLabel) .foregroundColor(.blue) }) } diff --git a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/SignedInView.swift b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/SignedInView.swift index 1cae13197e..a42ecc90bc 100644 --- a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/SignedInView.swift +++ b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/SignedInView.swift @@ -19,18 +19,22 @@ extension SignedInView: View { UpdatePasswordView() } else { VStack { - Text("Signed in") - Text("User: \(authService.currentUser?.email ?? "Unknown")") + Text(authService.string.signedInTitle) + .font(.largeTitle) + .fontWeight(.bold) + .padding() + Text(authService.string.accountSettingsEmailLabel) + Text("\(authService.currentUser?.email ?? "Unknown")") if authService.currentUser?.isEmailVerified == false { VerifyEmailView() } Divider() - Button("Update password") { + Button(authService.string.updatePasswordButtonLabel) { authService.authView = .updatePassword } Divider() - Button("Sign out") { + Button(authService.string.signOutButtonLabel) { Task { do { try await authService.signOut() @@ -38,7 +42,7 @@ extension SignedInView: View { } } Divider() - Button("Delete account") { + Button(authService.string.deleteAccountButtonLabel) { Task { do { try await authService.deleteUser() diff --git a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/UpdatePassword.swift b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/UpdatePassword.swift index cb7925197e..bb22706e72 100644 --- a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/UpdatePassword.swift +++ b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/UpdatePassword.swift @@ -35,7 +35,7 @@ extension UpdatePasswordView: View { public var body: some View { VStack { LabeledContent { - SecureField("Password", text: $password) + SecureField(authService.string.passwordInputLabel, text: $password) .focused($focus, equals: .password) .submitLabel(.go) } label: { @@ -48,7 +48,7 @@ extension UpdatePasswordView: View { Divider() LabeledContent { - SecureField("Confirm password", text: $confirmPassword) + SecureField(authService.string.confirmPasswordInputLabel, text: $confirmPassword) .focused($focus, equals: .confirmPassword) .submitLabel(.go) } label: { @@ -66,7 +66,7 @@ extension UpdatePasswordView: View { authService.authView = .authPicker } }, label: { - Text("Update password") + Text(authService.string.updatePasswordButtonLabel) .padding(.vertical, 8) .frame(maxWidth: .infinity) diff --git a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/VerifyEmailView.swift b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/VerifyEmailView.swift index ddf246c915..ca95ee1387 100644 --- a/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/VerifyEmailView.swift +++ b/FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/VerifyEmailView.swift @@ -21,7 +21,7 @@ extension VerifyEmailView: View { await sendEmailVerification() } }) { - Text("Verify email address?") + Text(authService.string.sendEmailVerificationButtonLabel) .padding(.vertical, 8) .frame(maxWidth: .infinity) } @@ -30,11 +30,9 @@ extension VerifyEmailView: View { .buttonStyle(.borderedProminent) }.sheet(isPresented: $showModal) { VStack { - Text("Instructions") + Text(authService.string.verifyEmailSheetMessage) .font(.headline) - Text("Please check your email for verification link.") - .padding() - Button("Dismiss") { + Button(authService.string.okButtonLabel) { showModal = false } .padding() diff --git a/FirebaseSwiftUI/FirebaseFacebookSwiftUI/Sources/Views/SignInWithFacebookButton.swift b/FirebaseSwiftUI/FirebaseFacebookSwiftUI/Sources/Views/SignInWithFacebookButton.swift index 3520fe67c7..c04b3e0898 100644 --- a/FirebaseSwiftUI/FirebaseFacebookSwiftUI/Sources/Views/SignInWithFacebookButton.swift +++ b/FirebaseSwiftUI/FirebaseFacebookSwiftUI/Sources/Views/SignInWithFacebookButton.swift @@ -66,7 +66,7 @@ extension SignInWithFacebookButton: View { Image(systemName: "f.circle.fill") .font(.title) .foregroundColor(.white) - Text("Continue with Facebook") + Text(authService.string.facebookLoginButtonLabel) .fontWeight(.semibold) .foregroundColor(.white) } @@ -77,13 +77,13 @@ extension SignInWithFacebookButton: View { } .alert(isPresented: $showCanceledAlert) { Alert( - title: Text("Facebook login cancelled"), - dismissButton: .default(Text("OK")) + title: Text(authService.string.facebookLoginCancelledLabel), + dismissButton: .default(Text(authService.string.okButtonLabel)) ) } HStack { - Text("Authorize User Tracking") + Text(authService.string.authorizeUserTrackingLabel) .font(.footnote) .foregroundColor(.blue) .underline() @@ -93,16 +93,16 @@ extension SignInWithFacebookButton: View { Toggle(isOn: limitedLoginBinding) { HStack { Spacer() // This will push the text to the left of the toggle - Text("Limited Login") + Text(authService.string.facebookLimitedLoginLabel) .foregroundColor(.blue) } } .toggleStyle(SwitchToggleStyle(tint: .green)) .alert(isPresented: $showUserTrackingAlert) { Alert( - title: Text("Authorize User Tracking"), - message: Text("For classic Facebook login, please authorize user tracking."), - dismissButton: .default(Text("OK")) + title: Text(authService.string.authorizeUserTrackingLabel), + message: Text(authService.string.facebookAuthorizeUserTrackingMessage), + dismissButton: .default(Text(authService.string.okButtonLabel)) ) } } diff --git a/FirebaseSwiftUI/FirebasePhoneAuthSwiftUI/Sources/Views/PhoneAuthButtonView.swift b/FirebaseSwiftUI/FirebasePhoneAuthSwiftUI/Sources/Views/PhoneAuthButtonView.swift index 4e971dcdea..5b71b156bc 100644 --- a/FirebaseSwiftUI/FirebasePhoneAuthSwiftUI/Sources/Views/PhoneAuthButtonView.swift +++ b/FirebaseSwiftUI/FirebasePhoneAuthSwiftUI/Sources/Views/PhoneAuthButtonView.swift @@ -19,7 +19,7 @@ extension PhoneAuthButtonView: View { if authService.authenticationState != .authenticating { VStack { LabeledContent { - TextField("Enter phone number", text: $phoneNumber) + TextField(authService.string.enterPhoneNumberLabel, text: $phoneNumber) .textInputAutocapitalization(.never) .disableAutocorrection(true) .submitLabel(.next) @@ -41,7 +41,7 @@ extension PhoneAuthButtonView: View { } } }) { - Text("Send SMS code") + Text(authService.string.smsCodeSentLabel) .padding(.vertical, 8) .frame(maxWidth: .infinity) } @@ -51,7 +51,7 @@ extension PhoneAuthButtonView: View { .buttonStyle(.borderedProminent) Text(errorMessage).foregroundColor(.red) }.sheet(isPresented: $showVerificationCodeInput) { - TextField("Enter verification code", text: $verificationCode) + TextField(authService.string.phoneNumberVerificationCodeLabel, text: $verificationCode) .keyboardType(.numberPad) .padding() .background(Color(.systemGray6)) @@ -71,7 +71,7 @@ extension PhoneAuthButtonView: View { showVerificationCodeInput = false } }) { - Text("Verify phone number and sign-in") + Text(authService.string.verifyPhoneNumberAndSignInLabel) .foregroundColor(.white) .padding() .frame(maxWidth: .infinity)