Skip to content

Commit 61f461b

Browse files
email auth view string localisation
1 parent 29051e7 commit 61f461b

File tree

3 files changed

+65
-18
lines changed

3 files changed

+65
-18
lines changed

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Strings/Localizable.xcstrings

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,18 @@
249249
}
250250
}
251251
},
252+
"ConfirmPasswordInputLabel" : {
253+
"comment" : "Input label for confirming password when signing up",
254+
"extractionState" : "manual",
255+
"localizations" : {
256+
"en" : {
257+
"stringUnit" : {
258+
"state" : "translated",
259+
"value" : "Confirm Password"
260+
}
261+
}
262+
}
263+
},
252264
"Delete" : {
253265
"comment" : "Text of Delete action button.",
254266
"extractionState" : "manual",
@@ -381,6 +393,18 @@
381393
}
382394
}
383395
},
396+
"EmailLinkSignInLabel" : {
397+
"comment" : "Button label for email link sign-in",
398+
"extractionState" : "manual",
399+
"localizations" : {
400+
"en" : {
401+
"stringUnit" : {
402+
"state" : "translated",
403+
"value" : "Prefer Email link sign-in?"
404+
}
405+
}
406+
}
407+
},
384408
"EmailsDontMatch" : {
385409
"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.",
386410
"extractionState" : "manual",
@@ -404,6 +428,9 @@
404428
}
405429
}
406430
}
431+
},
432+
"Enter Password" : {
433+
407434
},
408435
"EnterYourEmail" : {
409436
"comment" : "Title for email entry screen, email text field placeholder. Use short/abbreviated translation for 'email' which is less than 15 chars.",
@@ -488,9 +515,6 @@
488515
}
489516
}
490517
}
491-
},
492-
"Forgotten Password?" : {
493-
494518
},
495519
"Instructions" : {
496520

@@ -519,6 +543,9 @@
519543
}
520544
}
521545
},
546+
"Key" : {
547+
"extractionState" : "manual"
548+
},
522549
"Log in" : {
523550

524551
},
@@ -563,12 +590,6 @@
563590
}
564591
}
565592
}
566-
},
567-
"Password" : {
568-
"comment" : "Label next to a password text field."
569-
},
570-
"Password Recovery" : {
571-
572593
},
573594
"PasswordRecoveryEmailSentMessage" : {
574595
"comment" : "Message displayed when the email for password recovery has been sent.",
@@ -692,9 +713,6 @@
692713
},
693714
"Please check your email for email sign-in link." : {
694715

695-
},
696-
"Please check your email for password recovery instructions." : {
697-
698716
},
699717
"Please check your email for verification link." : {
700718

@@ -833,9 +851,6 @@
833851
},
834852
"Sign up" : {
835853

836-
},
837-
"Signed in" : {
838-
839854
},
840855
"SignedIn" : {
841856
"comment" : "Title of successfully signed in label.",
@@ -932,6 +947,9 @@
932947
}
933948
}
934949
}
950+
},
951+
"Submit" : {
952+
935953
},
936954
"TermsOfService" : {
937955
"comment" : "Text linked to a web page with the Terms of Service content.",

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Utils/StringUtils.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,34 @@ public class StringUtils {
130130
return localizedString(for: "SignedIn")
131131
}
132132

133+
/// Confirm password
134+
/// found in:
135+
/// - EmailAuthView
136+
public var confirmPasswordInputLabel: String {
137+
return localizedString(for: "ConfirmPasswordInputLabel")
138+
}
139+
140+
/// Sign in with email button label or can be used as title
141+
/// found in:
142+
/// EmailAuthView
143+
public var signInWithEmailButtonLabel: String {
144+
return localizedString(for: "SignInWithEmail")
145+
}
146+
147+
/// Sign up with email button label
148+
/// found in:
149+
/// - EmailAuthView
150+
public var signUpWithEmailButtonLabel: String {
151+
return localizedString(for: "SignUpTitle")
152+
}
153+
154+
/// Sign up with email link button label
155+
/// found in:
156+
/// - EmailAuthView
157+
public var signUpWithEmailLinkButtonLabel: String {
158+
return localizedString(for: "EmailLinkSignInLabel")
159+
}
160+
133161
/// General string - Back button label
134162
/// found in:
135163
/// - PasswordRecoveryView

FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Views/EmailAuthView.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ extension EmailAuthView: View {
8989

9090
if authService.authenticationFlow == .signUp {
9191
LabeledContent {
92-
SecureField("Confirm password", text: $confirmPassword)
92+
SecureField(authService.string.confirmPasswordInputLabel, text: $confirmPassword)
9393
.focused($focus, equals: .confirmPassword)
9494
.submitLabel(.go)
9595
.onSubmit {
@@ -110,7 +110,8 @@ extension EmailAuthView: View {
110110
}
111111
}) {
112112
if authService.authenticationState != .authenticating {
113-
Text(authService.authenticationFlow == .login ? "Log in with password" : "Sign up")
113+
Text(authService.authenticationFlow == .login ? authService.string
114+
.signInWithEmailButtonLabel : authService.string.signUpWithEmailButtonLabel)
114115
.padding(.vertical, 8)
115116
.frame(maxWidth: .infinity)
116117
} else {
@@ -127,7 +128,7 @@ extension EmailAuthView: View {
127128
Button(action: {
128129
authService.authView = .passwordRecovery
129130
}) {
130-
Text("Prefer Email link sign-in?")
131+
Text(authService.string.signUpWithEmailLinkButtonLabel)
131132
}
132133
}
133134
}

0 commit comments

Comments
 (0)