mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-28 06:25:04 -04:00
Library Localized Strings
This commit is contained in:
parent
043ad93fcd
commit
8c2c6a80aa
@ -20,7 +20,7 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel
|
|||||||
|
|
||||||
required init?(coder aDecoder: NSCoder) {
|
required init?(coder aDecoder: NSCoder) {
|
||||||
super.init(coder: aDecoder)
|
super.init(coder: aDecoder)
|
||||||
tabBarItem.title = LocalizedStrings.LibraryTabTitle.cloud
|
tabBarItem.title = LocalizedStrings.cloud
|
||||||
tabBarItem.image = UIImage(named: "Cloud")
|
tabBarItem.image = UIImage(named: "Cloud")
|
||||||
tabBarItem.selectedImage = UIImage(named: "CloudFilled")
|
tabBarItem.selectedImage = UIImage(named: "CloudFilled")
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel
|
|||||||
let hud = MBProgressHUD.showHUDAddedTo(view, animated: true)
|
let hud = MBProgressHUD.showHUDAddedTo(view, animated: true)
|
||||||
hud.mode = .Text
|
hud.mode = .Text
|
||||||
hud.label.numberOfLines = 0
|
hud.label.numberOfLines = 0
|
||||||
hud.label.text = NSLocalizedString("Library is refreshed successfully!", comment: "Cloud Book Controller")
|
hud.label.text = LocalizedStrings.libRefreshSuccessMessage
|
||||||
hud.hideAnimated(true, afterDelay: 2)
|
hud.hideAnimated(true, afterDelay: 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel
|
|||||||
let alert = UIAlertController(title: NSLocalizedString("Only Show Preferred Language?", comment: comment),
|
let alert = UIAlertController(title: NSLocalizedString("Only Show Preferred Language?", comment: comment),
|
||||||
message: NSLocalizedString(String(format: "Would you like to filter the library by %@?", string), comment: comment),
|
message: NSLocalizedString(String(format: "Would you like to filter the library by %@?", string), comment: comment),
|
||||||
preferredStyle: .Alert)
|
preferredStyle: .Alert)
|
||||||
let action = UIAlertAction(title: LocalizedStrings.Common.yes, style: .Default) { (action) in
|
let action = UIAlertAction(title: "Yes", style: .Default) { (action) in
|
||||||
self.managedObjectContext.performBlock({
|
self.managedObjectContext.performBlock({
|
||||||
let codes = NSLocale.preferredLangCodes
|
let codes = NSLocale.preferredLangCodes
|
||||||
Language.fetchAll(self.managedObjectContext).forEach({ (language) in
|
Language.fetchAll(self.managedObjectContext).forEach({ (language) in
|
||||||
@ -164,7 +164,7 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
alert.addAction(action)
|
alert.addAction(action)
|
||||||
alert.addAction(UIAlertAction(title: LocalizedStrings.Common.cancel, style: .Cancel, handler: nil))
|
alert.addAction(UIAlertAction(title: "Cancel", style: .Cancel, handler: nil))
|
||||||
alert.preferredAction = action
|
alert.preferredAction = action
|
||||||
presentViewController(alert, animated: true, completion: nil)
|
presentViewController(alert, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
@ -286,7 +286,7 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel
|
|||||||
action.backgroundColor = UIColor.orangeColor()
|
action.backgroundColor = UIColor.orangeColor()
|
||||||
return [action]
|
return [action]
|
||||||
case .NotEnough:
|
case .NotEnough:
|
||||||
let action = UITableViewRowAction(style: UITableViewRowActionStyle.Normal, title: LocalizedStrings.Library.spaceNotEnough, handler: { _ in
|
let action = UITableViewRowAction(style: UITableViewRowActionStyle.Normal, title: LocalizedStrings.spaceNotEnough, handler: { _ in
|
||||||
let alert = SpaceNotEnoughAlert(context: self)
|
let alert = SpaceNotEnoughAlert(context: self)
|
||||||
GlobalQueue.shared.addOperation(alert)
|
GlobalQueue.shared.addOperation(alert)
|
||||||
self.tableView.setEditing(false, animated: true)
|
self.tableView.setEditing(false, animated: true)
|
||||||
@ -369,4 +369,14 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel
|
|||||||
func controllerDidChangeContent(controller: NSFetchedResultsController) {
|
func controllerDidChangeContent(controller: NSFetchedResultsController) {
|
||||||
tableView.endUpdates()
|
tableView.endUpdates()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - LocalizedStrings
|
||||||
|
|
||||||
|
class LocalizedStrings{
|
||||||
|
static let cloud = NSLocalizedString("Cloud", comment: "Library, cloud tab")
|
||||||
|
|
||||||
|
static let download = NSLocalizedString("Download", comment: "Library, cloud tab")
|
||||||
|
static let spaceNotEnough = NSLocalizedString("Space Not Enough", comment: "Library, cloud tab")
|
||||||
|
static let libRefreshSuccessMessage = NSLocalizedString("Library is refreshed successfully!", comment: "Library, cloud tab")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ class DownloadTasksController: UITableViewController, NSFetchedResultsController
|
|||||||
if string.containsString(" — ") {
|
if string.containsString(" — ") {
|
||||||
return string.stringByReplacingOccurrencesOfString(" — ", withString: "\n")
|
return string.stringByReplacingOccurrencesOfString(" — ", withString: "\n")
|
||||||
} else {
|
} else {
|
||||||
return string + "\n" + "Estimating"
|
return string + "\n" + LocalizedStrings.estimating
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return string + "\n" + String(downloadTask.state)
|
return string + "\n" + String(downloadTask.state)
|
||||||
@ -131,10 +131,9 @@ class DownloadTasksController: UITableViewController, NSFetchedResultsController
|
|||||||
cell.detailLabel.text = {
|
cell.detailLabel.text = {
|
||||||
let downloadedSize = NSByteCountFormatter.stringFromByteCount(downloadTask.totalBytesWritten, countStyle: .File)
|
let downloadedSize = NSByteCountFormatter.stringFromByteCount(downloadTask.totalBytesWritten, countStyle: .File)
|
||||||
let fileSize = book.fileSizeDescription
|
let fileSize = book.fileSizeDescription
|
||||||
return String(format: "%@ of %@ completed", downloadedSize, fileSize) + "\n" + String(downloadTask.state)
|
return String(format: LocalizedStrings.percentCompleted, downloadedSize, fileSize) + "\n" + String(downloadTask.state)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Other Data Source
|
// MARK: Other Data Source
|
||||||
@ -186,21 +185,21 @@ class DownloadTasksController: UITableViewController, NSFetchedResultsController
|
|||||||
var actions = [UITableViewRowAction]()
|
var actions = [UITableViewRowAction]()
|
||||||
switch downloadTask.state {
|
switch downloadTask.state {
|
||||||
case .Downloading:
|
case .Downloading:
|
||||||
let pause = UITableViewRowAction(style: .Normal, title: "Pause") { (action, indexPath) in
|
let pause = UITableViewRowAction(style: .Normal, title: LocalizedStrings.pause) { (action, indexPath) in
|
||||||
let operation = PauseBookDwonloadOperation(bookID: bookID)
|
let operation = PauseBookDwonloadOperation(bookID: bookID)
|
||||||
Network.shared.queue.addOperation(operation)
|
Network.shared.queue.addOperation(operation)
|
||||||
tableView.setEditing(false, animated: true)
|
tableView.setEditing(false, animated: true)
|
||||||
}
|
}
|
||||||
actions.insert(pause, atIndex: 0)
|
actions.insert(pause, atIndex: 0)
|
||||||
case .Paused:
|
case .Paused:
|
||||||
let resume = UITableViewRowAction(style: .Normal, title: "Resume") { (action, indexPath) in
|
let resume = UITableViewRowAction(style: .Normal, title: LocalizedStrings.resume) { (action, indexPath) in
|
||||||
let operation = ResumeBookDwonloadOperation(bookID: bookID)
|
let operation = ResumeBookDwonloadOperation(bookID: bookID)
|
||||||
Network.shared.queue.addOperation(operation)
|
Network.shared.queue.addOperation(operation)
|
||||||
tableView.setEditing(false, animated: true)
|
tableView.setEditing(false, animated: true)
|
||||||
}
|
}
|
||||||
actions.insert(resume, atIndex: 0)
|
actions.insert(resume, atIndex: 0)
|
||||||
case .Error:
|
case .Error:
|
||||||
let restart = UITableViewRowAction(style: .Normal, title: "Restart") { (action, indexPath) in
|
let restart = UITableViewRowAction(style: .Normal, title: LocalizedStrings.restart) { (action, indexPath) in
|
||||||
let operation = ResumeBookDwonloadOperation(bookID: bookID)
|
let operation = ResumeBookDwonloadOperation(bookID: bookID)
|
||||||
Network.shared.queue.addOperation(operation)
|
Network.shared.queue.addOperation(operation)
|
||||||
tableView.setEditing(false, animated: true)
|
tableView.setEditing(false, animated: true)
|
||||||
@ -294,6 +293,14 @@ class DownloadTasksController: UITableViewController, NSFetchedResultsController
|
|||||||
|
|
||||||
class LocalizedStrings {
|
class LocalizedStrings {
|
||||||
static let download = NSLocalizedString("Download", comment: "Library, download tab")
|
static let download = NSLocalizedString("Download", comment: "Library, download tab")
|
||||||
|
|
||||||
|
static let pause = NSLocalizedString("Pause", comment: "Library, download tab")
|
||||||
|
static let resume = NSLocalizedString("Resume", comment: "Library, download tab")
|
||||||
|
static let restart = NSLocalizedString("Restart", comment: "Library, download tab")
|
||||||
|
static let cancel = NSLocalizedString("Cancel", comment: "Library, download tab")
|
||||||
|
|
||||||
|
static let estimating = NSLocalizedString("Estimating", comment: "Library, download tab")
|
||||||
|
static let percentCompleted = NSLocalizedString("%@ of %@ completed", comment: "Library, download tab")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class LocalBooksController: UITableViewController, NSFetchedResultsControllerDel
|
|||||||
|
|
||||||
required init?(coder aDecoder: NSCoder) {
|
required init?(coder aDecoder: NSCoder) {
|
||||||
super.init(coder: aDecoder)
|
super.init(coder: aDecoder)
|
||||||
tabBarItem.title = LocalizedStrings.LibraryTabTitle.local
|
tabBarItem.title = LocalizedStrings.local
|
||||||
tabBarItem.image = UIImage(named: "Folder")
|
tabBarItem.image = UIImage(named: "Folder")
|
||||||
tabBarItem.selectedImage = UIImage(named: "FolderFilled")
|
tabBarItem.selectedImage = UIImage(named: "FolderFilled")
|
||||||
}
|
}
|
||||||
@ -191,4 +191,11 @@ class LocalBooksController: UITableViewController, NSFetchedResultsControllerDel
|
|||||||
func controllerDidChangeContent(controller: NSFetchedResultsController) {
|
func controllerDidChangeContent(controller: NSFetchedResultsController) {
|
||||||
tableView.endUpdates()
|
tableView.endUpdates()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - LocalizedStrings
|
||||||
|
|
||||||
|
class LocalizedStrings{
|
||||||
|
static let local = NSLocalizedString("Local", comment: "Library, local tab")
|
||||||
|
static let remove = NSLocalizedString("Remove", comment: "Library, local tab")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.8.827</string>
|
<string>1.8.838</string>
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.8.830</string>
|
<string>1.8.841</string>
|
||||||
<key>NSExtension</key>
|
<key>NSExtension</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionMainStoryboard</key>
|
<key>NSExtensionMainStoryboard</key>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user