Merge remote-tracking branch 'tyiu/tyiu/translations'

This commit is contained in:
William Casarin
2023-02-26 15:48:55 -08:00
29 changed files with 755 additions and 109 deletions

View File

@@ -7,13 +7,11 @@
import Foundation
func bundleForLocale(locale: Locale) -> Bundle {
let path = Bundle.main.path(forResource: locale.identifier, ofType: "lproj")
func bundleForLocale(locale: Locale?) -> Bundle {
if locale == nil {
return Bundle.main
}
let path = Bundle.main.path(forResource: locale!.identifier, ofType: "lproj")
return path != nil ? (Bundle(path: path!) ?? Bundle.main) : Bundle.main
}
func formatInt(_ int: Int) -> String {
let numberFormatter = NumberFormatter()
numberFormatter.numberStyle = .decimal
return numberFormatter.string(from: NSNumber(integerLiteral: int)) ?? "\(int)"
}