Localize-Swift
Localize-Swift copied to clipboard
Does not work in UITests
Having tried all day, I cannot get Localize-Swift to work in UITests. Apparently this could have something to do with the wrong bundle being used.
(lldb) po NSLocalizedString("PASSWORD", comment: "")
"PASSWORD"
(lldb) po NSLocalizedString("PASSWORD", bundle: NSBundle(path: NSBundle(forClass: CaribooUITests.self).pathForResource("en", ofType: "lproj")!)!, comment: "")
"Password"
(lldb) po "PASSWORD".localized()
"PASSWORD"
I have no idea how to implement this and would appreciate help !
Hey @SASDOE, you are on the right path... Localise-Swift is looking for the mainBundle (always) and that doesn't work from the the test bundle. I'll try and find a good fix for this...
Cheers. I'd love to give a helping hand but I know nothing about localization and haven't been able to find a way for this to work in a retro compatible fashion. I've been told the Base bundle is just a random container in the UITests, not sure if that helps.
Tell me if you find a solution and need help writing it up.
@marmelroy What you thing about use the same approach used at: Swifternalization?
- Turning your library settings possible with a singleton;
- Localize.configure(bundle) // if files are in another bundle