Use iOS localization handling for strings. (#803)

This commit is contained in:
Doug
2023-04-17 15:58:39 +01:00
committed by GitHub
parent 6efae84c04
commit d01349a60e
14 changed files with 59 additions and 130 deletions
@@ -72,15 +72,10 @@ public enum UntranslatedL10n {
extension UntranslatedL10n {
static func tr(_ table: String, _ key: String, _ args: CVarArg...) -> String {
// No need to check languages, we always default to en for untranslated strings
guard let bundle = Bundle(for: BundleToken.self).lprojBundle(for: "en") else {
// no translations for the desired language
return key
}
guard let bundle = Bundle.lprojBundle(for: "en") else { return key }
let format = NSLocalizedString(key, tableName: table, bundle: bundle, comment: "")
return String(format: format, locale: Locale(identifier: "en"), arguments: args)
}
}
private final class BundleToken {}
// swiftlint:enable all