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

Localization improvement #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions PasscodeLock/Functions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import Foundation
func localizedStringFor(key: String, comment: String) -> String {

let name = "PasscodeLock"
let bundle = bundleForResource(name, ofType: "strings")
let defaultString = NSLocalizedString(key, tableName: name, bundle: NSBundle(forClass: PasscodeLock.self), comment: comment)

return NSLocalizedString(key, tableName: name, bundle: bundle, comment: comment)
return NSLocalizedString(key, value: defaultString, tableName: name, bundle: NSBundle.mainBundle(), comment: comment)
}

func bundleForResource(name: String, ofType type: String) -> NSBundle {
Expand Down
3 changes: 3 additions & 0 deletions PasscodeLock/PasscodeLockViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public class PasscodeLockViewController: UIViewController, PasscodeLockTypeDeleg
super.viewDidLoad()

updatePasscodeView()

cancelButton?.setTitle(localizedStringFor("PasscodeLockCancelButtonTitle", comment: "Cancel Button Title"), forState: .Normal)
deleteSignButton?.setTitle(localizedStringFor("PasscodeLockDeleteButtonTitle", comment: "Delete Button Title"), forState: .Normal)
deleteSignButton?.enabled = false

setupEvents()
Expand Down
6 changes: 6 additions & 0 deletions PasscodeLock/en.lproj/PasscodeLock.strings
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
"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";

Expand Down