Skip to content

Commit

Permalink
Merge pull request #12 from plangrid/bgonzales/fix-translations
Browse files Browse the repository at this point in the history
Update translations and images bundle
  • Loading branch information
bgonzales-adsk authored Aug 19, 2024
2 parents 8153edc + f89dbd4 commit 35130fc
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions Sources/Helpers/Functions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@ import AVFoundation
- Returns: An image.
*/
func imageNamed(_ name: String) -> UIImage {
let cls = BarcodeScannerViewController.self
var bundle = Bundle(for: cls)
let traitCollection = UITraitCollection(displayScale: 3)

if let resourceBundle = bundle.resourcePath.flatMap({ Bundle(path: $0 + "/BarcodeScanner.bundle") }) {
bundle = resourceBundle
}

guard let image = UIImage(named: name, in: bundle, compatibleWith: traitCollection) else {
guard let image = UIImage(named: name, in: Bundle.module, compatibleWith: traitCollection) else {
return UIImage()
}

Expand All @@ -28,11 +22,7 @@ func imageNamed(_ name: String) -> UIImage {
- Returns: An image.
*/
func localizedString(_ key: String) -> String {
if let path = Bundle(for: BarcodeScannerViewController.self).resourcePath,
let resourceBundle = Bundle(path: path + "/Localization.bundle") {
return resourceBundle.localizedString(forKey: key, value: nil, table: "Localizable")
}
return key
return Bundle.module.localizedString(forKey: key, value: nil, table: "Localizable")
}

/// Checks if the app is running in Simulator.
Expand Down

0 comments on commit 35130fc

Please sign in to comment.