Skip to content

Commit d0c20c3

Browse files
password recovery string localisation
1 parent bcfbf4f commit d0c20c3

3 files changed

Lines changed: 37 additions & 9 deletions

File tree

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Utils/StringUtils.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
import FirebaseAuth
22
import SwiftUI
33

4+
// Auth Picker (not signed-in)
45
let kAuthPickerTitle = "AuthPickerTitle"
56

7+
// Used across multiple Views
68
let kEnterYourEmail = "EnterYourEmail"
79
let kEnterYourPassword = "EnterYourPassword"
10+
let kOK = "OK"
11+
let kBack = "Back"
812

13+
// Signed-in
914
let kSignedInTitle = "SignedIn"
1015

16+
let kForgotPasswordButtonLabel = "ForgotPasswordTitle"
17+
let kForgotPasswordInputLabel = "ForgotPassword"
18+
19+
// Password recovery
20+
let kPasswordRecoveryTitle = "PasswordRecoveryTitle"
21+
let kPasswordRecoveryEmailSentTitle = "PasswordRecoveryEmailSentTitle"
22+
let kPasswordRecoveryMessage = "PasswordRecoveryMessage"
23+
let kPasswordRecoveryEmailSentMessage = "PasswordRecoveryEmailSentMessage"
24+
1125
let kKeyNotFound = "Key not found"
1226

27+
// Errors
1328
let kUsersNotFoundError = "UserNotFoundError"
1429
let kEmailAlreadyInUseError = "EmailAlreadyInUseError"
1530
let kInvalidEmailError = "InvalidEmailError"

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/EmailAuthView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ extension EmailAuthView: View {
8383
Button(action: {
8484
authService.authView = .passwordRecovery
8585
}) {
86-
Text("Forgotten Password?")
86+
Text(authService.string.localizedString(for: kForgotPasswordButtonLabel))
8787
}
8888
}
8989

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/PasswordRecoveryView.swift

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ public struct PasswordRecoveryView {
1818
extension PasswordRecoveryView: View {
1919
public var body: some View {
2020
VStack {
21-
Text("Password Recovery")
21+
Text(authService.string.localizedString(for: kPasswordRecoveryTitle))
22+
.font(.largeTitle)
23+
.fontWeight(.bold)
24+
.padding()
25+
26+
Divider()
27+
2228
LabeledContent {
23-
TextField("Email", text: $email)
29+
TextField(authService.string.localizedString(for: kEnterYourEmail), text: $email)
2430
.textInputAutocapitalization(.never)
2531
.disableAutocorrection(true)
2632
.submitLabel(.next)
@@ -34,7 +40,7 @@ extension PasswordRecoveryView: View {
3440
await sendPasswordRecoveryEmail()
3541
}
3642
}) {
37-
Text("Password Recovery")
43+
Text(authService.string.localizedString(for: kForgotPasswordInputLabel))
3844
.padding(.vertical, 8)
3945
.frame(maxWidth: .infinity)
4046
}
@@ -44,11 +50,18 @@ extension PasswordRecoveryView: View {
4450
.buttonStyle(.borderedProminent)
4551
}.sheet(isPresented: $showModal) {
4652
VStack {
47-
Text("Instructions")
48-
.font(.headline)
49-
Text("Please check your email for password recovery instructions.")
53+
Text(authService.string.localizedString(for: kPasswordRecoveryEmailSentTitle))
54+
.font(.largeTitle)
55+
.fontWeight(.bold)
56+
.padding()
57+
Text(authService.string.localizedString(for: kPasswordRecoveryMessage))
58+
.padding()
59+
60+
Divider()
61+
62+
Text(authService.string.localizedString(for: kPasswordRecoveryEmailSentMessage))
5063
.padding()
51-
Button("Dismiss") {
64+
Button(authService.string.localizedString(for: kOK)) {
5265
showModal = false
5366
}
5467
.padding()
@@ -62,7 +75,7 @@ extension PasswordRecoveryView: View {
6275
}) {
6376
Image(systemName: "chevron.left")
6477
.foregroundColor(.blue)
65-
Text("Back")
78+
Text(authService.string.localizedString(for: kBack))
6679
.foregroundColor(.blue)
6780
})
6881
}

0 commit comments

Comments
 (0)