iOS本地化不一致 [英] iOS localization inconsistency

查看:70
本文介绍了iOS本地化不一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是第一次将iPhone应用程序本地化.我已将所有字符串放入Localizable.strings文件,可从代码内通过NSLocalizedString访问它们.工作正常. 接下来,我有一个名为info.html的文件,其中包含我用作关于"框的UIWebView的内容.我将其放在语言文件夹(en.lprojde.lproj)中,并将它们添加到Xcode的资源中. 现在,在Simulator中,字符串和html文件都以适当的语言显示. 但是,在设备上,字符串显示为本地化,而html文件仍未翻译.

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.

这是模拟器和设备之间的奇怪不一致!有人知道解决方法吗? (...除了违反本地化系统,而是使用NSLocalizedString手动调用de_info.htmlen_info.html等.)

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

推荐答案

尝试首先删除该应用.

使用Xcode部署到设备(或模拟器)时,仅添加而不删除资源.
现在最有可能您具有三个html文件.在de文件夹中一个,在en文件夹中一个,在根文件夹中一个.

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.

如果有的话,iOS更喜欢根文件夹中的那个.

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.

这篇关于iOS本地化不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆