Closed nickbit closed 9 years ago
Could the test bundle think it only has 1 localisation, while the app itself can support many?
I added the localization files in the test target. This didn't change anything.
The expected value is english, while the returned value by the object tested is non english like expect("english", "non english")
Is there a way to synchronize the localizations?
I'm afraid this is outside of my scope, I've not done enough localization to know what's going on here. Anyone else?
You will need to look at using NSLocalizedStringFromTableInBundle()
rather than plain old NSLocalizedString()
, and pass it the correct bundle for your app/framework. objc.io did a pretty great overview a while back: http://nshipster.com/nslocalizedstring/
Thank you all for your answers. The problem was that the NSLocalizedString was redefined in the project but not in the test class. Had to import the relevant header file to fix that. Closing the issue.
I have something like this
The return statement for
messageWithCreditCardError:OKPCreditCardErrorCCNumberTooShort
is exactly the same (NSLocalizedString(@"CC number too short", nil)
) and the test still fails. Seems that the localization for the class is non english (which is correct) while the localization for the test class is english.Any thoughts?