Joe Völker
Joe Völker

Reputation: 791

iOS localization inconsistency

I'm localizing an iPhone app for the first time. I've put all my strings into a Localizable.strings file, accessing them via NSLocalizedString from within my code. Works fine. Next, I have a file called info.html that contains the flesh of a UIWebView that I use as an About box. I've put it in the language folders (en.lproj and de.lproj), and added them to my Resources in Xcode. Now, in Simulator, both the Strings, and the html file display in the appropriate language. However, on the device, the Strings appear localized while the html file remains untranslated.

This is a strange inconsistency between Simulator and Device! Anybody know of a workaround? (...other than defying the localization system, and using NSLocalizedString to call de_info.html, en_info.html etc. by hand.)

Upvotes: 3

Views: 1226

Answers (2)

KPK
KPK

Reputation: 467

Another addition: I also needed to remove the app from my current build directory to make it work (otherwise, the deleted app on the device was then replaced with the wrong version again).

In XCode you can press the 'alt' key within the 'Build' menu and then you have the option to clean the whole build directory.

That finally solved the issue for me. Sigh...

Upvotes: 4

Matthias Bauch
Matthias Bauch

Reputation: 90117

Try to delete the app first.

When you use Xcode to deploy to the device (or simulator) resources are only added, not removed.
Most likely now you have three html files. One in the de folder, one in the en folder and one in the root folder.

And if it's there iOS prefers the one in the root folder.

As a general rule: When you remove (or like in this case move them around) resources from your project, you should delete the app from the device or the simulator.

Upvotes: 7

Related Questions