开发者

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.)


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.


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜