diff --git a/PasscodeLock/Functions.swift b/PasscodeLock/Functions.swift index 173caf16..717a806a 100644 --- a/PasscodeLock/Functions.swift +++ b/PasscodeLock/Functions.swift @@ -8,19 +8,19 @@ import Foundation -func localizedStringFor(_ key: String, comment: String) -> String { - +func localizedStringFor(key: String, comment: String) -> String { + let name = "PasscodeLock" - let bundle = bundleForResource(name, ofType: "strings") - - return NSLocalizedString(key, tableName: name, bundle: bundle, comment: comment) + let defaultString = NSLocalizedString(key, tableName: name, bundle: NSBundle(forClass: PasscodeLock.self), comment: comment) + + return NSLocalizedString(key, value: defaultString, tableName: name, bundle: NSBundle.mainBundle(), comment: comment) } -func bundleForResource(_ name: String, ofType type: String) -> Bundle { - - if(Bundle.main.path(forResource: name, ofType: type) != nil) { - return Bundle.main +func bundleForResource(name: String, ofType type: String) -> NSBundle { + + if(NSBundle.mainBundle().pathForResource(name, ofType: type) != nil) { + return NSBundle.mainBundle() } - - return Bundle(for: PasscodeLock.self) + + return NSBundle(forClass: PasscodeLock.self) } diff --git a/PasscodeLock/PasscodeLockViewController.swift b/PasscodeLock/PasscodeLockViewController.swift index 3a298ca9..b3866457 100644 --- a/PasscodeLock/PasscodeLockViewController.swift +++ b/PasscodeLock/PasscodeLockViewController.swift @@ -86,6 +86,9 @@ open class PasscodeLockViewController: UIViewController, PasscodeLockTypeDelegat updatePasscodeView() deleteSignButton?.isEnabled = false + + cancelButton?.setTitle(localizedStringFor("PasscodeLockCancelButtonTitle", comment: "Cancel Button Title"), forState: .Normal) + deleteSignButton?.setTitle(localizedStringFor("PasscodeLockDeleteButtonTitle", comment: "Delete Button Title"), forState: .Normal) setupEvents() } diff --git a/PasscodeLock/en.lproj/PasscodeLock.strings b/PasscodeLock/en.lproj/PasscodeLock.strings index f71ef86c..ec1e3afe 100755 --- a/PasscodeLock/en.lproj/PasscodeLock.strings +++ b/PasscodeLock/en.lproj/PasscodeLock.strings @@ -26,8 +26,13 @@ "PasscodeLockMismatchTitle" = "Try again"; "PasscodeLockMismatchDescription" = "Passcodes didn\'t match."; +/* Cancel Button Title */ +"PasscodeLockCancelButtonTitle" = "Cancel"; + +/* Delete Button Title */ +"PasscodeLockDeleteButtonTitle" = "Delete"; /* Touch ID Reason */ "PasscodeLockTouchIDReason" = "Authentication required to proceed"; /* Touch ID Fallback Button */ -"PasscodeLockTouchIDButton" = "Enter Passcode"; \ No newline at end of file +"PasscodeLockTouchIDButton" = "Enter Passcode";