Skip to content

Commit

Permalink
use default language where there is no translation
Browse files Browse the repository at this point in the history
  • Loading branch information
whoeevee committed Oct 24, 2024
1 parent 7b0b9db commit 61c6b45
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Sources/EeveeSpotify/Premium/Helpers/BundleHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ class BundleHelper {
private let bundleName = "EeveeSpotify"

private let bundle: Bundle
private let enBundle: Bundle

static let shared = BundleHelper()

private init() {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 61c6b45

Please sign in to comment.