Fix localization issues, add tests, import translations, and add zh-CN and zh-TW

Closes: #689
This commit is contained in:
2023-02-24 12:26:43 -05:00
committed by William Casarin
parent 85e797a054
commit 5cd4c2d75e
73 changed files with 1061 additions and 600 deletions

View File

@@ -0,0 +1,19 @@
//
// LocalizationUtil.swift
// damus
//
// Created by Terry Yiu on 2/24/23.
//
import Foundation
func bundleForLocale(locale: Locale) -> Bundle {
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)"
}