Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internationalised hardcoded strings #595

Merged
merged 2 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Lock/Base.lproj/Lock.strings
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"com.auth0.lock.database.separator" = "or";
// User signed up
"com.auth0.lock.database.signup.success.message" = "Thanks for signing up.";
// Accept
"com.auth0.lock.database.tos.sheet.accept" = "Accept";
// Cancel
"com.auth0.lock.database.tos.sheet.cancel" = "Cancel";
// Privacy
Expand Down
4 changes: 2 additions & 2 deletions Lock/DatabasePresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ class DatabasePresenter: Presentable, Loggable {
let alert = UIAlertController(title: terms, message: "By signing up, you agree to our terms of\n service and privacy policy".i18n(key: "com.auth0.lock.database.button.tos", comment: "tos & privacy"), preferredStyle: .alert)
alert.popoverPresentationController?.sourceView = button
alert.popoverPresentationController?.sourceRect = button.bounds
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
let okAction = UIAlertAction(title: "Accept", style: .default) { _ in
let cancelAction = UIAlertAction(title: "Cancel".i18n(key: "com.auth0.lock.database.tos.sheet.cancel", comment: "Cancel"), style: .cancel, handler: nil)
let okAction = UIAlertAction(title: "Accept".i18n(key: "com.auth0.lock.database.tos.sheet.accept", comment: "Accept"), style: .default) { _ in
successHandler(button)
}
[cancelAction, okAction].forEach { alert.addAction($0) }
Expand Down
2 changes: 1 addition & 1 deletion Lock/Validators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public class PasswordPolicyValidator: InputValidator {
func validate(_ value: String?) -> Error? {
let result = self.policy.on(value)
self.delegate?.update(withRules: result)
let valid = result.reduce(true) { $0 && $1.valid }
let valid = result.allSatisfy { $0.valid }
guard !valid else { return nil }
return InputValidationError.passwordPolicyViolation(result: result.filter { !$0.valid })
}
Expand Down