Fix localization issues, and export and import translations

This commit is contained in:
2023-03-16 22:55:54 -04:00
parent eabbb12195
commit f367df2225
27 changed files with 715 additions and 56 deletions

View File

@@ -15,3 +15,9 @@ 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 localizedStringFormat(key: String, locale: Locale?) -> String {
let bundle = bundleForLocale(locale: locale)
let fallback = bundleForLocale(locale: Locale(identifier: "en-US")).localizedString(forKey: key, value: nil, table: nil)
return bundle.localizedString(forKey: key, value: fallback, table: nil)
}