use default language where there is no translation

This commit is contained in:
eevee
2024-10-24 18:19:36 +03:00
parent 7b0b9dba40
commit 61c6b45f08
@@ -6,6 +6,8 @@ class BundleHelper {
private let bundleName = "EeveeSpotify"
private let bundle: Bundle
private let enBundle: Bundle
static let shared = BundleHelper()
private init() {
@@ -16,6 +18,8 @@ class BundleHelper {
)
?? jbRootPath("/Library/Application Support/\(bundleName).bundle")
)!
enBundle = Bundle(path: bundle.path(forResource: "en", ofType: "lproj")!)!
}
func uiImage(_ name: String) -> UIImage {
@@ -28,7 +32,13 @@ class BundleHelper {
}
func localizedString(_ key: String) -> String {
return bundle.localizedString(forKey: key, value: nil, table: nil)
let value = bundle.localizedString(forKey: key, value: "No translation", table: nil)
if value != "No translation" {
return value
}
return enBundle.localizedString(forKey: key, value: nil, table: nil)
}
func resolveConfiguration() throws -> ResolveConfiguration {