In my App I\'m using NSLocalizedString
to localize my app. Now I want to switch to UITests
and habe Testcode like this:
[tabBarsQue
I've made localized screenshots with Fastlane using next scheme:
1) Add to Fastfile next param:
localize_simulator: true
2) Use this code to get localized string:
class LocalizationHelper: NSObject {
class func localizedString(_ key: String) -> String {
let testBundle = Bundle(for: UITests.self)
let currentLocale = Locale.current
if let code = currentLocale.languageCode,
let testBundlePath = testBundle.path(forResource: code, ofType: "lproj") ?? testBundle.path(forResource: code, ofType: "lproj"), let localizedBundle = Bundle(path: testBundlePath) {
return NSLocalizedString(key, bundle: localizedBundle, comment: "")
}
return ""
}
}