Skip to content

Commit

Permalink
trans_cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
nixzhu committed Aug 12, 2016
1 parent 9499f58 commit 4e7dd62
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Yep/AlbumListController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final class AlbumListController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()

let cancelButton = UIBarButtonItem(title: NSLocalizedString("Cancel", comment: ""), style: .Plain, target: self, action: #selector(AlbumListController.cancel(_:)))
let cancelButton = UIBarButtonItem(title: String.trans_cancel, style: .Plain, target: self, action: #selector(AlbumListController.cancel(_:)))
navigationItem.rightBarButtonItem = cancelButton
navigationItem.hidesBackButton = true

Expand Down
3 changes: 3 additions & 0 deletions Yep/Extensions/String+Trans.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ extension String {
return NSLocalizedString("prompt.cancel_recommended_feed_failed", comment: "")
}

static var trans_cancel: String {
return NSLocalizedString("cancel", comment: "")
}

}

Expand Down
4 changes: 2 additions & 2 deletions Yep/Extensions/UIViewController+Yep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ extension UIViewController {
reportAlertController.addAction(scamsReasonAction)

let otherReasonAction: UIAlertAction = UIAlertAction(title: ReportReason.Other("").title, style: .Default) { [weak self] _ in
YepAlert.textInput(title: NSLocalizedString("Other Reason", comment: ""), message: nil, placeholder: nil, oldText: nil, confirmTitle: NSLocalizedString("OK", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: { text in
YepAlert.textInput(title: NSLocalizedString("Other Reason", comment: ""), message: nil, placeholder: nil, oldText: nil, confirmTitle: NSLocalizedString("OK", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: { text in
reportWithReason(.Other(text))
}, cancelAction: nil)
}
reportAlertController.addAction(otherReasonAction)

let cancelAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .Cancel) { [weak self] _ in
let cancelAction: UIAlertAction = UIAlertAction(title: String.trans_cancel, style: .Cancel) { [weak self] _ in
self?.dismissViewControllerAnimated(true, completion: nil)
}
reportAlertController.addAction(cancelAction)
Expand Down
2 changes: 1 addition & 1 deletion Yep/ViewControllers/Contacts/ContactsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ extension ContactsViewController: UITableViewDataSource, UITableViewDelegate {

tableView?.setEditing(false, animated: true)

YepAlert.confirmOrCancel(title: NSLocalizedString("Unfriend", comment: ""), message: String(format: NSLocalizedString("Do you want to unfriend with %@?", comment: ""), nickname), confirmTitle: NSLocalizedString("Confirm", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("Unfriend", comment: ""), message: String(format: NSLocalizedString("Do you want to unfriend with %@?", comment: ""), nickname), confirmTitle: NSLocalizedString("Confirm", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: {

unfriend(withUserID: userID, failureHandler: { [weak self] (reason, errorMessage) in
let message = errorMessage ?? NSLocalizedString("Unfriend failed!", comment: "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi

if message.sendState == MessageSendState.Failed.rawValue {

YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend image?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend image?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: {

resendMessage(message, failureHandler: { [weak self] reason, errorMessage in
defaultFailureHandler(reason: reason, errorMessage: errorMessage)
Expand Down Expand Up @@ -752,7 +752,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi

if message.sendState == MessageSendState.Failed.rawValue {

YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend audio?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend audio?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: {

resendMessage(message, failureHandler: { [weak self] reason, errorMessage in
defaultFailureHandler(reason: reason, errorMessage: errorMessage)
Expand Down Expand Up @@ -787,7 +787,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi

if message.sendState == MessageSendState.Failed.rawValue {

YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend video?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend video?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: {

resendMessage(message, failureHandler: { [weak self] reason, errorMessage in
defaultFailureHandler(reason: reason, errorMessage: errorMessage)
Expand Down Expand Up @@ -828,7 +828,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi

if message.sendState == MessageSendState.Failed.rawValue {

YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend location?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend location?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: {

resendMessage(message, failureHandler: { [weak self] reason, errorMessage in
defaultFailureHandler(reason: reason, errorMessage: errorMessage)
Expand Down Expand Up @@ -870,7 +870,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi
return
}

YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend text?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend text?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: {

resendMessage(message, failureHandler: { [weak self] reason, errorMessage in
defaultFailureHandler(reason: reason, errorMessage: errorMessage)
Expand Down Expand Up @@ -1305,7 +1305,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi
if message.sendState == MessageSendState.Failed.rawValue {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend image?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend image?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: {
resendMessage(message, failureHandler: { [weak self] reason, errorMessage in
defaultFailureHandler(reason: reason, errorMessage: errorMessage)
Expand Down Expand Up @@ -1346,7 +1346,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi
if message.sendState == MessageSendState.Failed.rawValue {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend audio?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend audio?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: {
resendMessage(message, failureHandler: { [weak self] reason, errorMessage in
defaultFailureHandler(reason: reason, errorMessage: errorMessage)
Expand Down Expand Up @@ -1379,7 +1379,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi
if message.sendState == MessageSendState.Failed.rawValue {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend video?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend video?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: {
resendMessage(message, failureHandler: { [weak self] reason, errorMessage in
defaultFailureHandler(reason: reason, errorMessage: errorMessage)
Expand Down Expand Up @@ -1418,7 +1418,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi
if message.sendState == MessageSendState.Failed.rawValue {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend location?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend location?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: {
resendMessage(message, failureHandler: { [weak self] reason, errorMessage in
defaultFailureHandler(reason: reason, errorMessage: errorMessage)
Expand Down Expand Up @@ -1459,7 +1459,7 @@ extension ConversationViewController: UICollectionViewDataSource, UICollectionVi
return
}
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend text?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: {
YepAlert.confirmOrCancel(title: NSLocalizedString("title.action", comment: ""), message: NSLocalizedString("Resend text?", comment: ""), confirmTitle: NSLocalizedString("Resend", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: {
resendMessage(message, failureHandler: { [weak self] reason, errorMessage in
defaultFailureHandler(reason: reason, errorMessage: errorMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ extension ConversationViewController {
}

YepAlert.confirmOrCancel(title: NSLocalizedString("Notice", comment: ""), message: NSLocalizedString("Do you want to reject this friend request?", comment: "")
, confirmTitle: NSLocalizedString("Reject", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction:confirmAction, cancelAction: {
, confirmTitle: NSLocalizedString("Reject", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction:confirmAction, cancelAction: {
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ final class EditProfileViewController: SegueViewController {
}
alertController.addAction(takePhotoAction)

let cancelAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .Cancel) { [weak self] _ in
let cancelAction: UIAlertAction = UIAlertAction(title: String.trans_cancel, style: .Cancel) { [weak self] _ in
self?.dismissViewControllerAnimated(true, completion: nil)
}
alertController.addAction(cancelAction)
Expand Down Expand Up @@ -262,7 +262,7 @@ final class EditProfileViewController: SegueViewController {
// }
// alertController.addAction(uploadContactsAction)

let cancelAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .Cancel) { [weak self] _ in
let cancelAction: UIAlertAction = UIAlertAction(title: String.trans_cancel, style: .Cancel) { [weak self] _ in
self?.dismissViewControllerAnimated(true, completion: nil)
}
alertController.addAction(cancelAction)
Expand Down Expand Up @@ -647,7 +647,7 @@ extension EditProfileViewController: UITableViewDataSource, UITableViewDelegate
break
}

YepAlert.textInput(title: NSLocalizedString("Set Username", comment: ""), message: NSLocalizedString("Please note that you can only set username once.", comment: ""), placeholder: NSLocalizedString("use letters, numbers, and underscore", comment: ""), oldText: nil, confirmTitle: NSLocalizedString("Set", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: { text in
YepAlert.textInput(title: NSLocalizedString("Set Username", comment: ""), message: NSLocalizedString("Please note that you can only set username once.", comment: ""), placeholder: NSLocalizedString("use letters, numbers, and underscore", comment: ""), oldText: nil, confirmTitle: NSLocalizedString("Set", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: { text in

let newUsername = text

Expand Down Expand Up @@ -690,7 +690,7 @@ extension EditProfileViewController: UITableViewDataSource, UITableViewDelegate

case .LogOut:

YepAlert.confirmOrCancel(title: NSLocalizedString("Notice", comment: ""), message: NSLocalizedString("Do you want to logout?", comment: ""), confirmTitle: NSLocalizedString("Yes", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: { () -> Void in
YepAlert.confirmOrCancel(title: NSLocalizedString("Notice", comment: ""), message: NSLocalizedString("Do you want to logout?", comment: ""), confirmTitle: NSLocalizedString("Yes", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: { () -> Void in

logout(failureHandler: { [weak self] reason, errorMessage in
defaultFailureHandler(reason: reason, errorMessage: errorMessage)
Expand Down
2 changes: 1 addition & 1 deletion Yep/ViewControllers/Feeds/FeedsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ final class FeedsViewController: BaseViewController {

let alertController = UIAlertController(title: NSLocalizedString("Choose skill set", comment: ""), message: String(format: NSLocalizedString("Which skill set do you want %@ to be?", comment: ""), skillLocalName), preferredStyle: .Alert)

let cancelAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .Cancel) { action in
let cancelAction: UIAlertAction = UIAlertAction(title: String.trans_cancel, style: .Cancel) { action in
}
alertController.addAction(cancelAction)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ final class LoginByMobileViewController: BaseViewController {

if case .NoSuccessStatusCode(_, let errorCode) = reason where errorCode == .NotYetRegistered {

YepAlert.confirmOrCancel(title: NSLocalizedString("Notice", comment: ""), message: String(format: NSLocalizedString("This number (%@) not yet registered! Would you like to register it now?", comment: ""), "+\(areaCode) \(mobile)"), confirmTitle: NSLocalizedString("OK", comment: ""), cancelTitle: NSLocalizedString("Cancel", comment: ""), inViewController: self, withConfirmAction: { [weak self] in
YepAlert.confirmOrCancel(title: NSLocalizedString("Notice", comment: ""), message: String(format: NSLocalizedString("This number (%@) not yet registered! Would you like to register it now?", comment: ""), "+\(areaCode) \(mobile)"), confirmTitle: NSLocalizedString("OK", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: { [weak self] in

self?.performSegueWithIdentifier("showRegisterPickName", sender: ["mobile" : mobile, "areaCode": areaCode])

Expand Down
4 changes: 2 additions & 2 deletions Yep/ViewControllers/NewFeed/NewFeedViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ final class NewFeedViewController: SegueViewController {
navigationItem.rightBarButtonItem = postButton

if !attachment.needPrepare {
let cancleButton = UIBarButtonItem(title: NSLocalizedString("Cancel", comment: ""), style: .Plain, target: self, action: #selector(NewFeedViewController.cancel(_:)))
let cancleButton = UIBarButtonItem(title: String.trans_cancel, style: .Plain, target: self, action: #selector(NewFeedViewController.cancel(_:)))

navigationItem.leftBarButtonItem = cancleButton
}
Expand Down Expand Up @@ -1099,7 +1099,7 @@ extension NewFeedViewController: UICollectionViewDataSource, UICollectionViewDel

pickAlertController.addAction(albumAction)

let cancelAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .Cancel) { _ in
let cancelAction: UIAlertAction = UIAlertAction(title: String.trans_cancel, style: .Cancel) { _ in
}

pickAlertController.addAction(cancelAction)
Expand Down
Loading

0 comments on commit 4e7dd62

Please sign in to comment.