Add localizations to UI tests target (#118)

This commit is contained in:
ismailgulek
2022-06-29 18:32:14 +03:00
committed by GitHub
parent dbee1924eb
commit 7bd4763662
11 changed files with 116 additions and 83 deletions
+3 -17
View File
@@ -10,25 +10,11 @@ import Foundation
public extension Bundle {
/// Returns the real app bundle.
/// Can also be used in app extensions.
static let app: Bundle = {
let bundle = main
if bundle.bundleURL.pathExtension == "appex" {
// Peel off two directory levels - MY_APP.app/PlugIns/MY_APP_EXTENSION.appex
let url = bundle.bundleURL.deletingLastPathComponent().deletingLastPathComponent()
if let otherBundle = Bundle(url: url) {
return otherBundle
}
}
return bundle
}()
/// Get an lproj language bundle from the main app bundle.
/// Get an lproj language bundle from the receiver bundle.
/// - Parameter language: The language to try to load.
/// - Returns: The lproj bundle if found otherwise nil.
@objc static func lprojBundle(for language: String) -> Bundle? {
guard let lprojURL = Bundle.app.url(forResource: language, withExtension: "lproj") else { return nil }
func lprojBundle(for language: String) -> Bundle? {
guard let lprojURL = url(forResource: language, withExtension: "lproj") else { return nil }
return Bundle(url: lprojURL)
}