From 61c6b45f085249576ba3b255449e5ebe66ca0aac Mon Sep 17 00:00:00 2001 From: eevee Date: Thu, 24 Oct 2024 18:19:36 +0300 Subject: [PATCH] use default language where there is no translation --- .../EeveeSpotify/Premium/Helpers/BundleHelper.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Sources/EeveeSpotify/Premium/Helpers/BundleHelper.swift b/Sources/EeveeSpotify/Premium/Helpers/BundleHelper.swift index 5492e66..16326f8 100755 --- a/Sources/EeveeSpotify/Premium/Helpers/BundleHelper.swift +++ b/Sources/EeveeSpotify/Premium/Helpers/BundleHelper.swift @@ -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 {