In my App I\'m using NSLocalizedString
to localize my app. Now I want to switch to UITests
and habe Testcode like this:
[tabBarsQue
Objective-C Solution : inspired by @Volodymyr Prysiazhniuk solution
- (NSString*)getLocalizedStringForKey :(NSString*)stringKey forUITestClass : (id) uiTestClass{
if (!stringKey || !uiTestClass){
return nil;
}
NSString *bundlePath = [[NSBundle bundleForClass: uiTestClass]bundlePath];
NSBundle* bundle = [NSBundle bundleWithPath:bundlePath];
NSString* localizedString = NSLocalizedStringWithDefaultValue(stringKey, nil, bundle, nil, nil);
return localizedString;
}