Localize strings in code

This commit is contained in:
Danny Moesch 2019-01-14 20:57:45 +01:00 committed by Mingshen Sun
parent 2d5ca58bd9
commit 1b4040135e
36 changed files with 626 additions and 334 deletions

View file

@ -304,9 +304,11 @@ class PasswordTest: XCTestCase {
func testOtpStringsTotpToken() {
let password = getPasswordObjectWith(content: TOTP_URL)
let otpStrings = password.getOtpStrings()
let otpDescription = otpStrings!.description
XCTAssertNotNil(otpStrings)
XCTAssert(otpStrings!.description.hasPrefix("time-based (expires in"))
XCTAssert(otpDescription.hasPrefix("TimeBased".localize() + " ("))
XCTAssert(otpDescription.hasSuffix(")"))
}
func testOtpStringsHotpToken() {
@ -314,6 +316,6 @@ class PasswordTest: XCTestCase {
let otpStrings = password.getOtpStrings()
XCTAssertNotNil(otpStrings)
XCTAssertEqual(otpStrings!.description, "HMAC-based")
XCTAssertEqual(otpStrings!.description, "HmacBased".localize())
}
}

View file

@ -38,8 +38,8 @@ class OtpTypeTest: XCTestCase {
}
func testDescription() {
XCTAssertEqual(OtpType(name: "totp").description, "time-based")
XCTAssertEqual(OtpType(name: "hotp").description, "HMAC-based")
XCTAssertEqual(OtpType(name: nil).description, "none")
XCTAssertEqual(OtpType(name: "totp").description, "TimeBased".localize())
XCTAssertEqual(OtpType(name: "hotp").description, "HmacBased".localize())
XCTAssertEqual(OtpType(name: nil).description, "None".localize())
}
}