diff --git a/Yep/Extensions/String+Trans.swift b/Yep/Extensions/String+Trans.swift index e0be2da6a..c6c5a5496 100644 --- a/Yep/Extensions/String+Trans.swift +++ b/Yep/Extensions/String+Trans.swift @@ -112,6 +112,62 @@ extension String { static var trans_titleChats: String { return NSLocalizedString("title.chats", comment: "") } + + static var trans_titleChoosePhoto: String { + return NSLocalizedString("title.choose_photo", comment: "") + } + + static var trans_titleChooseSkillSet: String { + return NSLocalizedString("title.choose_skill_set", comment: "") + } + + static var trans_titleChooseSource: String { + return NSLocalizedString("title.choose_source", comment: "") + } + + static var trans_buttonChooseFromLibrary: String { + return NSLocalizedString("button.choose_from_library", comment: "") + } + + static var trans_promptChoose: String { + return NSLocalizedString("prompt.choose", comment: "") + } + + static var trans_titleClearHistory: String { + return NSLocalizedString("title.clear_history", comment: "") + } + + static var trans_confirm: String { + return NSLocalizedString("confirm", comment: "") + } + + static var trans_titleContacts: String { + return NSLocalizedString("title.contacts", comment: "") + } + + static var trans_titleCreateUsername: String { + return NSLocalizedString("title.create_username", comment: "") + } + + static var trans_promptCreateFeedFailed: String { + return NSLocalizedString("prompt.create_feed_failed", comment: "") + } + + static var trans_promptCreateUsernameFailed: String { + return NSLocalizedString("prompt.create_username_failed", comment: "") + } + + static var trans_titleCreate: String { + return NSLocalizedString("title.create", comment: "") + } + + static var trans_promptCreatorsOfBlockedFeeds: String { + return NSLocalizedString("prompt.creators_of_blocked_feeds", comment: "") + } + + static var trans_promptCurrentNumber: String { + return NSLocalizedString("prompt.current_number", comment: "") + } } extension String { diff --git a/Yep/ViewControllers/ChangeMobile/ChangeMobileViewController.swift b/Yep/ViewControllers/ChangeMobile/ChangeMobileViewController.swift index b79699dac..c2f592a6e 100644 --- a/Yep/ViewControllers/ChangeMobile/ChangeMobileViewController.swift +++ b/Yep/ViewControllers/ChangeMobile/ChangeMobileViewController.swift @@ -49,7 +49,7 @@ final class ChangeMobileViewController: UIViewController { changeMobileNumberPromptLabel.text = NSLocalizedString("What's your new number?", comment: "") - currentMobileNumberPromptLabel.text = NSLocalizedString("Current number:", comment: "") + currentMobileNumberPromptLabel.text = String.trans_promptCurrentNumber currentMobileNumberLabel.text = YepUserDefaults.fullPhoneNumber areaCodeTextField.text = NSTimeZone.areaCode diff --git a/Yep/ViewControllers/Contacts/ContactsViewController.swift b/Yep/ViewControllers/Contacts/ContactsViewController.swift index 01dec3dc4..d465f079f 100644 --- a/Yep/ViewControllers/Contacts/ContactsViewController.swift +++ b/Yep/ViewControllers/Contacts/ContactsViewController.swift @@ -103,7 +103,7 @@ final class ContactsViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() - navigationItem.title = NSLocalizedString("Contacts", comment: "") + navigationItem.title = String.trans_titleContacts NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(ContactsViewController.syncFriendships(_:)), name: FriendsInContactsViewController.Notification.NewFriends, object: nil) NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(ContactsViewController.deactiveSearchController(_:)), name: YepConfig.Notification.switchedToOthersFromContactsTab, object: nil) @@ -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: String.trans_cancel, inViewController: self, withConfirmAction: { + YepAlert.confirmOrCancel(title: NSLocalizedString("Unfriend", comment: ""), message: String(format: NSLocalizedString("Do you want to unfriend with %@?", comment: ""), nickname), confirmTitle: String.trans_confirm, cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: { unfriend(withUserID: userID, failureHandler: { [weak self] (reason, errorMessage) in let message = errorMessage ?? NSLocalizedString("Unfriend failed!", comment: "") diff --git a/Yep/ViewControllers/EditProfile/EditProfileViewController.swift b/Yep/ViewControllers/EditProfile/EditProfileViewController.swift index 7fec4d5ae..8ef5ecd63 100644 --- a/Yep/ViewControllers/EditProfile/EditProfileViewController.swift +++ b/Yep/ViewControllers/EditProfile/EditProfileViewController.swift @@ -182,7 +182,7 @@ final class EditProfileViewController: SegueViewController { let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .ActionSheet) - let choosePhotoAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Choose Photo", comment: ""), style: .Default) { _ in + let choosePhotoAction: UIAlertAction = UIAlertAction(title: String.trans_titleChoosePhoto, style: .Default) { _ in let openCameraRoll: ProposerAction = { [weak self] in diff --git a/Yep/ViewControllers/Feeds/FeedsViewController.swift b/Yep/ViewControllers/Feeds/FeedsViewController.swift index d4c90b1ac..97b334ef4 100644 --- a/Yep/ViewControllers/Feeds/FeedsViewController.swift +++ b/Yep/ViewControllers/Feeds/FeedsViewController.swift @@ -523,7 +523,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 alertController = UIAlertController(title: String.trans_titleChooseSkillSet, message: String(format: NSLocalizedString("Which skill set do you want %@ to be?", comment: ""), skillLocalName), preferredStyle: .Alert) let cancelAction: UIAlertAction = UIAlertAction(title: String.trans_cancel, style: .Cancel) { action in } diff --git a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift index 5d815e69f..8295ad94d 100644 --- a/Yep/ViewControllers/NewFeed/NewFeedViewController.swift +++ b/Yep/ViewControllers/NewFeed/NewFeedViewController.swift @@ -19,7 +19,7 @@ import RealmSwift import Kingfisher import MapKit -let generalSkill = Skill(category: nil, id: "", name: "general", localName: NSLocalizedString("Choose...", comment: ""), coverURLString: nil) +let generalSkill = Skill(category: nil, id: "", name: "general", localName: String.trans_promptChoose, coverURLString: nil) struct FeedVoice { @@ -257,7 +257,7 @@ final class NewFeedViewController: SegueViewController { } channelLabel.text = String.trans_promptChannel - choosePromptLabel.text = NSLocalizedString("Choose...", comment: "") + choosePromptLabel.text = String.trans_promptChoose channelViewTopConstraint.constant = 30 @@ -674,7 +674,7 @@ final class NewFeedViewController: SegueViewController { defaultFailureHandler(reason: reason, errorMessage: errorMessage) SafeDispatch.async { [weak self] in - let message = errorMessage ?? NSLocalizedString("Create feed failed!", comment: "") + let message = errorMessage ?? String.trans_promptCreateFeedFailed self?.uploadState = .Failed(message: message) } @@ -1064,7 +1064,7 @@ extension NewFeedViewController: UICollectionViewDataSource, UICollectionViewDel return } - let pickAlertController = UIAlertController(title: NSLocalizedString("Choose Source", comment: ""), message: nil, preferredStyle: .ActionSheet) + let pickAlertController = UIAlertController(title: String.trans_titleChooseSource, message: nil, preferredStyle: .ActionSheet) let cameraAction: UIAlertAction = UIAlertAction(title: String.trans_titleCamera, style: .Default) { _ in diff --git a/Yep/ViewControllers/Notifications/NotificationsViewController.swift b/Yep/ViewControllers/Notifications/NotificationsViewController.swift index 9e58a79a4..f2a4fb8c4 100644 --- a/Yep/ViewControllers/Notifications/NotificationsViewController.swift +++ b/Yep/ViewControllers/Notifications/NotificationsViewController.swift @@ -329,7 +329,7 @@ extension NotificationsViewController: UITableViewDataSource, UITableViewDelegat case .CreatorsOfBlockedFeeds: let cell: SettingsMoreCell = tableView.dequeueReusableCell() - cell.annotationLabel.text = NSLocalizedString("Creators of Blocked Feeds", comment: "") + cell.annotationLabel.text = String.trans_promptCreatorsOfBlockedFeeds return cell } diff --git a/Yep/ViewControllers/Profile/ProfileViewController.swift b/Yep/ViewControllers/Profile/ProfileViewController.swift index d55044201..8657cc190 100644 --- a/Yep/ViewControllers/Profile/ProfileViewController.swift +++ b/Yep/ViewControllers/Profile/ProfileViewController.swift @@ -691,14 +691,15 @@ final class ProfileViewController: SegueViewController { tryShareProfile() } else { - YepAlert.textInput(title: NSLocalizedString("Create a username", comment: ""), message: NSLocalizedString("In order to share your profile, create a unique username first.", comment: ""), placeholder: NSLocalizedString("use letters, numbers, and underscore", comment: ""), oldText: nil, confirmTitle: NSLocalizedString("Create", comment: ""), cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: { text in + YepAlert.textInput(title: String.trans_titleCreateUsername, message: NSLocalizedString("In order to share your profile, create a unique username first.", comment: ""), placeholder: NSLocalizedString("use letters, numbers, and underscore", comment: ""), oldText: nil, confirmTitle: String.trans_titleCreate, cancelTitle: String.trans_cancel, inViewController: self, withConfirmAction: { text in let newUsername = text updateMyselfWithInfo(["username": newUsername], failureHandler: { [weak self] reason, errorMessage in defaultFailureHandler(reason: reason, errorMessage: errorMessage) - YepAlert.alertSorry(message: errorMessage ?? NSLocalizedString("Create username failed!", comment: ""), inViewController: self) + let message = errorMessage ?? String.trans_promptCreateUsernameFailed + YepAlert.alertSorry(message: message, inViewController: self) }, completion: { success in SafeDispatch.async { [weak self] in diff --git a/Yep/ViewControllers/Register/RegisterPickAvatarViewController.swift b/Yep/ViewControllers/Register/RegisterPickAvatarViewController.swift index 7410bce44..f1268dcce 100644 --- a/Yep/ViewControllers/Register/RegisterPickAvatarViewController.swift +++ b/Yep/ViewControllers/Register/RegisterPickAvatarViewController.swift @@ -83,7 +83,7 @@ final class RegisterPickAvatarViewController: SegueViewController { pickAvatarState = .Default - openCameraButton.setTitle(NSLocalizedString("Choose from Library", comment: ""), forState: .Normal) + openCameraButton.setTitle(String.trans_buttonChooseFromLibrary, forState: .Normal) openCameraButton.setTitleColor(UIColor.whiteColor(), forState: .Normal) openCameraButton.backgroundColor = UIColor.yepTintColor() openCameraButton.rx_tap diff --git a/Yep/ViewControllers/SkillHome/SkillHomeViewController.swift b/Yep/ViewControllers/SkillHome/SkillHomeViewController.swift index 3111e000a..31827fcb3 100644 --- a/Yep/ViewControllers/SkillHome/SkillHomeViewController.swift +++ b/Yep/ViewControllers/SkillHome/SkillHomeViewController.swift @@ -149,7 +149,7 @@ final class SkillHomeViewController: BaseViewController { let alertController = UIAlertController(title: NSLocalizedString("Change skill cover", comment: ""), message: nil, preferredStyle: .ActionSheet) - let choosePhotoAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Choose Photo", comment: ""), style: .Default) { _ in + let choosePhotoAction: UIAlertAction = UIAlertAction(title: String.trans_titleChoosePhoto, style: .Default) { _ in let openCameraRoll: ProposerAction = { [weak self] in @@ -295,7 +295,7 @@ final class SkillHomeViewController: 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 alertController = UIAlertController(title: String.trans_titleChooseSkillSet, message: String(format: NSLocalizedString("Which skill set do you want %@ to be?", comment: ""), skillLocalName), preferredStyle: .Alert) let cancelAction: UIAlertAction = UIAlertAction(title: String.trans_cancel, style: .Cancel) { action in } diff --git a/Yep/ViewControllers/TabBar/YepTabBarController.swift b/Yep/ViewControllers/TabBar/YepTabBarController.swift index ff968a575..f1295e309 100644 --- a/Yep/ViewControllers/TabBar/YepTabBarController.swift +++ b/Yep/ViewControllers/TabBar/YepTabBarController.swift @@ -26,7 +26,7 @@ final class YepTabBarController: UITabBarController { case .Conversations: return String.trans_titleChats case .Contacts: - return NSLocalizedString("Contacts", comment: "") + return String.trans_titleContacts case .Feeds: return NSLocalizedString("Feeds", comment: "") case .Discover: diff --git a/Yep/en.lproj/Localizable.strings b/Yep/en.lproj/Localizable.strings index 8def70d01..33447c949 100644 --- a/Yep/en.lproj/Localizable.strings +++ b/Yep/en.lproj/Localizable.strings @@ -34,22 +34,20 @@ "title.chat_records" = "Chat Records"; "title.chat" = "Chat"; "title.chats" = "Chats"; -"Choose Photo" = "Choose Photo"; -"Choose Skill Set" = "Choose Skill Set"; -"Choose Source" = "Choose Source"; -"Choose from Library" = "Choose from Library"; -"Choose..." = "Choose..."; -"Clear history" = "Clear history"; -"Confirm" = "Confirm"; -"Contacts" = "Contacts"; -"Copy" = "Copy"; -"Create a username" = "Create a username"; -"Create feed failed!" = "Create feed failed!"; -"Create username failed!" = "Create username failed!"; -"Create" = "Create"; -"Created by %@ at %@" = "Created by %@ at %@"; -"Creators of Blocked Feeds" = "Creators of Blocked Feeds"; -"Current number:" = "Current number:"; +"title.choose_photo" = "Choose Photo"; +"title.choose_skill_set" = "Choose Skill Set"; +"title.choose_source" = "Choose Source"; +"button.choose_from_library" = "Choose from Library"; +"prompt.choose" = "Choose..."; +"title.clear_history" = "Clear History"; +"confirm" = "Confirm"; +"title.contacts" = "Contacts"; +"title.create_username" = "Create a Username"; +"prompt.create_feed_failed" = "Create feed failed!"; +"prompt.create_username_failed" = "Create username failed!"; +"title.create" = "Create"; +"prompt.creators_of_blocked_feeds" = "Creators of Blocked Feeds"; +"prompt.current_number" = "Current Number:"; "Default" = "Default"; "Delete" = "Delete"; "Didn't get it?" = "Didn't get it?"; diff --git a/Yep/zh-Hans.lproj/Localizable.strings b/Yep/zh-Hans.lproj/Localizable.strings index 87cdf9739..2a2495f2e 100644 --- a/Yep/zh-Hans.lproj/Localizable.strings +++ b/Yep/zh-Hans.lproj/Localizable.strings @@ -34,22 +34,20 @@ "title.chat_records" = "聊天记录"; "title.chat" = "聊天"; "title.chats" = "聊天"; -"Choose Photo" = "选择照片"; -"Choose Skill Set" = "选择技能集合"; -"Choose Source" = "选择"; -"Choose from Library" = "从相册选取"; -"Choose..." = "选择…"; -"Clear history" = "清除历史记录"; -"Confirm" = "确定"; -"Contacts" = "联系人"; -"Copy" = "复制"; -"Create a username" = "创建用户名"; -"Create feed failed!" = "创建话题失败!"; -"Create username failed!" = "创建用户名失败!"; -"Create" = "创建"; -"Created by %@ at %@" = "%@ 创建于 %@"; +"title.choose_photo" = "选择照片"; +"title.choose_skill_set" = "选择技能集合"; +"title.choose_source" = "选择"; +"button.choose_from_library" = "从相册选取"; +"prompt.choose" = "选择…"; +"title.clear_history" = "清除历史记录"; +"confirm" = "确定"; +"title.contacts" = "联系人"; +"title.create_username" = "创建用户名"; +"prompt.create_feed_failed" = "创建话题失败!"; +"prompt.create_username_failed" = "创建用户名失败!"; +"title.create" = "创建"; "Creators of Blocked Feeds" = "被屏蔽的话题创建者"; -"Current number:" = "当前号码"; +"prompt.current_number" = "当前号码"; "Default" = "默认"; "Delete" = "删除"; "Didn't get it?" = "没有收到?"; diff --git a/YepKit/Persistence/Models.swift b/YepKit/Persistence/Models.swift index 8773ac2d5..5db5d0dda 100644 --- a/YepKit/Persistence/Models.swift +++ b/YepKit/Persistence/Models.swift @@ -2068,7 +2068,7 @@ public func tryDeleteOrClearHistoryOfConversation(conversation: Conversation, in let deleteAlertController = UIAlertController(title: nil, message: nil, preferredStyle: .ActionSheet) - let clearHistoryAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("Clear history", comment: ""), style: .Default) { _ in + let clearHistoryAction: UIAlertAction = UIAlertAction(title: NSLocalizedString("title.clear_history", comment: ""), style: .Default) { _ in clearMessages()