Skip to content

Commit

Permalink
Merge branch 'feature/trans' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nixzhu committed Aug 15, 2016
2 parents 36dab80 + 486d32a commit 25a7a8d
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 48 deletions.
56 changes: 56 additions & 0 deletions Yep/Extensions/String+Trans.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Yep/ViewControllers/Contacts/ContactsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down 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: 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: "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

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 @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions Yep/ViewControllers/NewFeed/NewFeedViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
5 changes: 3 additions & 2 deletions Yep/ViewControllers/Profile/ProfileViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Yep/ViewControllers/SkillHome/SkillHomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion Yep/ViewControllers/TabBar/YepTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
30 changes: 14 additions & 16 deletions Yep/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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?";
Expand Down
28 changes: 13 additions & 15 deletions Yep/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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?" = "没有收到?";
Expand Down
2 changes: 1 addition & 1 deletion YepKit/Persistence/Models.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 25a7a8d

Please sign in to comment.