Skip to content

Commit cc6ec0b

Browse files
committed
Added more localized strings from view models.
1 parent c28bf57 commit cc6ec0b

12 files changed

+132
-39
lines changed

Authenticator.xcodeproj/project.pbxproj

-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
5156D05F265D3CEF007A94F8 /* TokenRequestViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5156D05E265D3CEF007A94F8 /* TokenRequestViewModel.swift */; };
3939
5180974326DE185100A122C1 /* ResetOATHViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5180974226DE185100A122C1 /* ResetOATHViewModel.swift */; };
4040
51A162862678A1F100C3FA1E /* OATHConfigurationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51A162852678A1F100C3FA1E /* OATHConfigurationController.swift */; };
41-
51AFD4D42716FC78008F2630 /* NFCSettingsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51AFD4D32716FC78008F2630 /* NFCSettingsController.swift */; };
4241
51AFD4D62716FCDB008F2630 /* ApplicationSettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51AFD4D52716FCDB008F2630 /* ApplicationSettingsViewModel.swift */; };
4342
51AFD4D827196AB6008F2630 /* VersionHistory.plist in Resources */ = {isa = PBXBuildFile; fileRef = 51AFD4D727196AB6008F2630 /* VersionHistory.plist */; };
4443
51AFD4DA271D4278008F2630 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51AFD4D9271D4277008F2630 /* QuartzCore.framework */; };
@@ -778,9 +777,7 @@
778777
5155428326569ADD00B19C59 /* UIControl+Extensions.swift in Sources */,
779778
B452EC1F2A1E4F460045E5D9 /* YubiOtpRowView.swift in Sources */,
780779
A544948F23CE546B003E1E07 /* TutorialPagesViewControllers.swift in Sources */,
781-
51AFD4D42716FC78008F2630 /* NFCSettingsController.swift in Sources */,
782780
B4719B19298AA757006CDAEA /* AuthenticatorApp.swift in Sources */,
783-
51AFD4D42716FC78008F2630 /* NFCSettingsController.swift in Sources */,
784781
51394C5C26D4D460009F366D /* MenuGestureRecognizer.swift in Sources */,
785782
A5588BF9239B0A7F003E4CA5 /* FavoritesStorage.swift in Sources */,
786783
B4B1711827DF8C48002A62DE /* ScanAccountView.swift in Sources */,

Authenticator/AuthenticatorApp.swift

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
import SwiftUI
18+
import YubiKit
1819

1920
@main
2021
struct AuthenticatorApp: App {
@@ -38,6 +39,10 @@ struct AuthenticatorApp: App {
3839
.navigationViewStyle(.stack)
3940
.environmentObject(toastPresenter)
4041
.environmentObject(notificationsViewModel)
42+
.onAppear {
43+
YubiKitExternalLocalization.nfcScanAlertMessage = String(localized: "Scan your YubiKey", comment: "iOS NFC alert scan")
44+
YubiKitExternalLocalization.nfcScanSuccessAlertMessage = String(localized: "Success", comment: "iOS NFC alert default success message")
45+
}
4146
}
4247
}
4348
}

Authenticator/Localizable.xcstrings

+91-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@
1313
"About" : {
1414
"comment" : "About view navigation title"
1515
},
16+
"Account deleted" : {
17+
"comment" : "OATH NFC account deleted"
18+
},
1619
"Account name can not be empty" : {
1720
"comment" : "Rename credential alert"
1821
},
1922
"Account not set" : {
2023
"comment" : "Rename credential alert"
2124
},
25+
"Account renamed" : {
26+
"comment" : "OATH NFC account renamed"
27+
},
2228
"Accounts" : {
2329
"comment" : "Navigation title in main view.",
2430
"localizations" : {
@@ -51,6 +57,9 @@
5157
"and can be used by other applications" : {
5258
"comment" : "PIV extension substring in 'These certificates have been added to this [iPad/iPhone] and can be used by other applications'"
5359
},
60+
"Authentication required" : {
61+
"comment" : "Password Configuration auth required"
62+
},
5463
"Calculate" : {
5564
"comment" : "Menu"
5665
},
@@ -92,6 +101,9 @@
92101
"Close" : {
93102
"comment" : "View close button"
94103
},
104+
"Code calculated" : {
105+
"comment" : "OATH NFC code calculated"
106+
},
95107
"Code expired" : {
96108
"comment" : "Accessibility label"
97109
},
@@ -210,6 +222,9 @@
210222
"Dismiss details view" : {
211223
"comment" : "Accessibility hint"
212224
},
225+
"Duplicate accounts!" : {
226+
"comment" : "OATH add credential duplicate accounts error"
227+
},
213228
"Enabled" : {
214229
"comment" : "PIV extension enabled message"
215230
},
@@ -256,14 +271,20 @@
256271
"Failed to reset YubiKey" : {
257272
"comment" : "Reset YubiKey failure alert title"
258273
},
274+
"Finished reading certificates" : {
275+
"comment" : "PIV extension NFC finished reading certs"
276+
},
259277
"Incorrect password. Re-enter password." : {
260-
"comment" : "Password entry error alert message"
278+
"comment" : "OATH password entry retry"
261279
},
262280
"Insert YubiKey" : {
263281

264282
},
265283
"Insert YubiKey or pull down to activate NFC" : {
266284

285+
},
286+
"Invalid signature" : {
287+
"comment" : "PIV extension NFC invalid signature"
267288
},
268289
"Invalid URI format" : {
269290
"comment" : "Invalid Uri, wrong parameters",
@@ -298,6 +319,9 @@
298319
}
299320
}
300321
},
322+
"Key is password protected" : {
323+
"comment" : "OATH NFC password protected key"
324+
},
301325
"Licensing" : {
302326
"comment" : "Licensing view navigation title"
303327
},
@@ -307,6 +331,9 @@
307331
"Never for this YubiKey" : {
308332
"comment" : "Save password alert."
309333
},
334+
"New OTP configuration saved" : {
335+
"comment" : "Settings OTP configuration saved"
336+
},
310337
"No account information found!" : {
311338
"comment" : "Scan QR code no account error message"
312339
},
@@ -343,12 +370,18 @@
343370
"Notifications disabled" : {
344371
"comment" : "PIV extension notifications alert title"
345372
},
373+
"OATH accounts deleted and OATH application reset to factory defaults." : {
374+
"comment" : "OATH reset confirmation message"
375+
},
346376
"Ok" : {
347377
"comment" : "Password alert"
348378
},
349379
"OK" : {
350380
"comment" : "OK button in error alert."
351381
},
382+
"on this YubiKey" : {
383+
"comment" : "OATH substring in 'There's already an account named [issuer, name] on this YubiKey."
384+
},
352385
"Open iOS Settings app" : {
353386
"comment" : "Scan QR code settings button"
354387
},
@@ -383,6 +416,15 @@
383416
"Password can not be an empty string" : {
384417
"comment" : "Configuration set password empty password error alert message"
385418
},
419+
"Password has been changed" : {
420+
"comment" : "Password Configuration password changed"
421+
},
422+
"Password has been removed" : {
423+
"comment" : "Password Configuration password removed"
424+
},
425+
"Password has been set" : {
426+
"comment" : "Password Configuration password set"
427+
},
386428
"Period" : {
387429
"comment" : "Add account select period"
388430
},
@@ -431,6 +473,9 @@
431473
"Read more..." : {
432474
"comment" : "PIV extension read more alert title"
433475
},
476+
"Read YubiKey OTP configuration" : {
477+
"comment" : "Settings OTP configuration read"
478+
},
434479
"Remove and re-insert your YubiKey" : {
435480
"localizations" : {
436481
"fr" : {
@@ -485,6 +530,9 @@
485530
},
486531
"Scan NFC YubiKey" : {
487532

533+
},
534+
"Scan your YubiKey" : {
535+
"comment" : "iOS NFC alert scan"
488536
},
489537
"Search" : {
490538

@@ -495,11 +543,17 @@
495543
"Settings" : {
496544
"comment" : "PIV extension settings alert title"
497545
},
546+
"Signing failed" : {
547+
"comment" : "PIV extension signing failed error message"
548+
},
498549
"Smart card extension" : {
499550
"comment" : "PIV extension info alert title"
500551
},
501552
"Smart card extension is only available on iOS 14.5 and forward." : {
502553
"comment" : "PIV extension version error"
554+
},
555+
"Something went wrong" : {
556+
503557
},
504558
"Something went wrong and key doesn't respond" : {
505559
"comment" : "No response",
@@ -538,7 +592,16 @@
538592
}
539593
},
540594
"Success" : {
541-
"comment" : "Clear passwords confirmation alert title"
595+
"comment" : "Clear passwords confirmation alert title\niOS NFC alert default success message"
596+
},
597+
"Success!\nHint: swipe down to dismiss" : {
598+
"comment" : "iOS NFC alert success with hint"
599+
},
600+
"Successfully read" : {
601+
"comment" : "iOS NFC alert successfully read"
602+
},
603+
"Successfully signed data" : {
604+
"comment" : "PIV extension NFC successfully signed data"
542605
},
543606
"The key doesn't respond" : {
544607
"comment" : "Timeout issue",
@@ -560,9 +623,18 @@
560623
"The passwords do not match" : {
561624
"comment" : "Configuration set password not matching error alert message"
562625
},
626+
"The private key on the YubiKey does not match the certificate or there is no private key stored on the YubiKey." : {
627+
"comment" : "PIV extension NFC invalid signature no private key"
628+
},
629+
"The private key on the YubiKey does not match the certificate." : {
630+
"comment" : "PIV extension invalid signature message"
631+
},
563632
"The smart card extension requires notifications to be enabled for Yubico Authenticator. Enable it in the iOS Settings." : {
564633
"comment" : "PIV extensions notifications alert message"
565634
},
635+
"There's already an account named" : {
636+
"comment" : "OATH substring in 'There's already an account named [issuer, name] on this YubiKey."
637+
},
566638
"These certificates have been added to this" : {
567639
"comment" : "PIV extension substring in 'These certificates have been added to this [iPad/iPhone] and can be used by other applications'"
568640
},
@@ -639,7 +711,7 @@
639711
}
640712
},
641713
"To prevent unauthorized access this YubiKey is protected with a password." : {
642-
"comment" : "Password entry alert message"
714+
"comment" : "OATH password entry enter password"
643715
},
644716
"To scan a QR code you need to enable camera permissions for the Authenticator app." : {
645717
"comment" : "Scan QR code camera error message"
@@ -669,6 +741,9 @@
669741
"Unpin" : {
670742
"comment" : "Menu"
671743
},
744+
"Use your PUK code to reset PIN." : {
745+
"comment" : "PIV extension pin blocked text"
746+
},
672747
"Version history" : {
673748
"comment" : "Version history navigation title"
674749
},
@@ -697,9 +772,18 @@
697772
"Would you like to save this password for YubiKey for next usage in this application?" : {
698773
"comment" : "Password entry save password title"
699774
},
775+
"Wrong password" : {
776+
"comment" : "Password Configuration wrong password"
777+
},
778+
"Wrong PIN code" : {
779+
"comment" : "PIV extension wrong pin"
780+
},
700781
"You can remove saved password in Settings." : {
701782
"comment" : "Password entry save password message"
702783
},
784+
"Your PIN has ben blocked" : {
785+
"comment" : "PIV extension pin blocked title"
786+
},
703787
"Yubico OTP" : {
704788
"localizations" : {
705789
"fr" : {
@@ -717,6 +801,7 @@
717801
}
718802
},
719803
"Yubico OTP enabled" : {
804+
"comment" : "OATH otp enabled error message",
720805
"localizations" : {
721806
"fr" : {
722807
"stringUnit" : {
@@ -747,6 +832,9 @@
747832
}
748833
}
749834
}
835+
},
836+
"YubiKey information read" : {
837+
"comment" : "YubiKey info NFC read"
750838
}
751839
},
752840
"version" : "1.0"

Authenticator/Model/MainViewModel.swift

+10-10
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class MainViewModel: ObservableObject {
156156
account.update(otp: otp)
157157
}
158158

159-
session.endNFC(message: "Code calculated")
159+
session.endNFC(message: String(localized: "Code calculated", comment: "OATH NFC code calculated"))
160160
} catch {
161161
handle(error: error, retry: { Task { await self.updateAccount(account) }})
162162
}
@@ -210,7 +210,7 @@ class MainViewModel: ObservableObject {
210210
}
211211

212212
self.accountsLoaded = true
213-
let message = SettingsConfig.showNFCSwipeHint ? "Success!\nHint: swipe down to dismiss" : "Successfully read"
213+
let message = SettingsConfig.showNFCSwipeHint ? String(localized: "Success!\nHint: swipe down to dismiss", comment: "iOS NFC alert success with hint") : String(localized: "Successfully read", comment: "iOS NFC alert successfully read")
214214
useSession.endNFC(message: message)
215215
} catch {
216216
handle(error: error, retry: { Task { await self.updateAccounts() }})
@@ -233,7 +233,7 @@ class MainViewModel: ObservableObject {
233233
let session = try await OATHSessionHandler.shared.nfcSession()
234234
await updateAccounts(using: session)
235235
} catch {
236-
YubiKitManager.shared.stopNFCConnection(withErrorMessage: "Something went wrong")
236+
YubiKitManager.shared.stopNFCConnection(withErrorMessage: String(localized: "Something went wrong"))
237237
self.sessionError = error
238238
}
239239
}
@@ -265,7 +265,7 @@ class MainViewModel: ObservableObject {
265265
account.updateTitles()
266266
account.isPinned = wasPinned
267267
await updateAccounts(using: session)
268-
YubiKitManager.shared.stopNFCConnection(withMessage: "Account renamed")
268+
YubiKitManager.shared.stopNFCConnection(withMessage: String(localized: "Account renamed", comment: "OATH NFC account renamed"))
269269
completion()
270270
} catch {
271271
handle(error: error, retry: { self.renameAccount(account, issuer: issuer, accountName: accountName, completion: completion) })
@@ -281,7 +281,7 @@ class MainViewModel: ObservableObject {
281281
accounts.removeAll { $0.accountId == account.accountId }
282282
pinnedAccounts.removeAll { $0.accountId == account.accountId }
283283
otherAccounts.removeAll { $0.accountId == account.accountId }
284-
session.endNFC(message: "Account deleted")
284+
session.endNFC(message: String(localized: "Account deleted", comment: "OATH NFC account deleted"))
285285
completion()
286286
} catch {
287287
handle(error: error, retry: { self.deleteAccount(account, completion: completion) })
@@ -291,8 +291,8 @@ class MainViewModel: ObservableObject {
291291

292292
func collectPasswordAndUnlock(isRetry: Bool = false, completion: @escaping (Error?) -> Void) {
293293
DispatchQueue.main.async {
294-
YubiKitManager.shared.stopNFCConnection(withErrorMessage: "Key is password protected")
295-
self.passwordEntryMessage = isRetry ? "Incorrect password. Re-enter password." : "To prevent unauthorized access this YubiKey is protected with a password."
294+
YubiKitManager.shared.stopNFCConnection(withErrorMessage: String(localized: "Key is password protected", comment: "OATH NFC password protected key"))
295+
self.passwordEntryMessage = isRetry ? String(localized: "Incorrect password. Re-enter password.", comment: "OATH password entry retry") : String(localized: "To prevent unauthorized access this YubiKey is protected with a password.", comment: "OATH password entry enter password")
296296
self.presentPasswordEntry = true
297297
self.passwordCancellable = self.password.sink { password in
298298
if let password {
@@ -324,7 +324,7 @@ class MainViewModel: ObservableObject {
324324
} catch {
325325
self.collectPasswordAndUnlock() { error in
326326
if let error {
327-
YubiKitManager.shared.stopNFCConnection(withErrorMessage: "Something went wrong")
327+
YubiKitManager.shared.stopNFCConnection(withErrorMessage: String(localized: "Something went wrong"))
328328
self.handle(error: error, retry: retry)
329329
} else {
330330
retry?()
@@ -335,7 +335,7 @@ class MainViewModel: ObservableObject {
335335
} else {
336336
self.collectPasswordAndUnlock() { error in
337337
if let error {
338-
YubiKitManager.shared.stopNFCConnection(withErrorMessage: "Something went wrong")
338+
YubiKitManager.shared.stopNFCConnection(withErrorMessage: String(localized: "Something went wrong"))
339339
self.handle(error: error, retry: retry)
340340
} else {
341341
retry?()
@@ -346,7 +346,7 @@ class MainViewModel: ObservableObject {
346346
} else if let oathError = error as? YKFOATHError, oathError.code == YKFOATHErrorCode.wrongPassword.rawValue {
347347
collectPasswordAndUnlock(isRetry: true) { error in
348348
if let error {
349-
YubiKitManager.shared.stopNFCConnection(withErrorMessage: "Something went wrong")
349+
YubiKitManager.shared.stopNFCConnection(withErrorMessage: String(localized: "Something went wrong"))
350350
self.handle(error: error, retry: retry)
351351
} else {
352352
retry?()

Authenticator/Model/ManagementViewModel.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ManagementViewModel {
5555
return
5656
}
5757
session.getDeviceInfo { deviceInfo, error in
58-
YubiKitManager.shared.stopNFCConnection(withMessage: "Read YubiKey OTP configuration")
58+
YubiKitManager.shared.stopNFCConnection(withMessage: String(localized: "Read YubiKey OTP configuration", comment: "Settings OTP configuration read"))
5959
guard let deviceInfo = deviceInfo else { completion(.failure(error!)); return }
6060
guard let configuration = deviceInfo.configuration else {
6161
completion(.failure(ManagementViewModelError.unknownError))
@@ -103,7 +103,7 @@ class ManagementViewModel {
103103
completion(errorToPassOn)
104104
return
105105
} else {
106-
YubiKitManager.shared.stopNFCConnection(withMessage: "New OTP configuration saved")
106+
YubiKitManager.shared.stopNFCConnection(withMessage: String(localized: "New OTP configuration saved", comment: "Settings OTP configuration saved"))
107107
}
108108
completion(nil)
109109
}

0 commit comments

Comments
 (0)