本地化不起作用 [英] Localization not working
问题描述
我有一个应该本地化的应用程序(两种语言,默认为英语).
I have an application that is supposed to be localized (two languages, english being the default).
但是,无论系统默认语言是什么,我似乎都只能获得所有字符串的英语版本.我可能缺少一些琐碎的东西,但是我现在已经读了几本教程,没有任何解决方法.
However, I seem to only get the English versions of all strings, regardless of what the system default language is. I am probably missing something trivial, but I've read several tutorials now without any solution.
我将此行添加到main(),
I added this line to main(),
NSLog(@"Current locale is: %@", [[NSLocale currentLocale] localeIdentifier]);
系统设置为使用本地化语言时,结果打印为en_US
.
and the resulting printout is en_US
, while the system was set to use the localized language.
我检查了构建输出,并且该应用程序包包含XX.lproj文件夹,正如我认为的那样(它们是UTF-16,我确认了这一点).
I checked the build output, and the app bundle contains the XX.lproj folders as I believe they should (and they are UTF-16, I confirmed this).
我想念什么?
编辑:当我通过发行证书通过iTunes部署应用程序时,似乎本地化工作正常,但使用XCode(Command-R或类似程序)时,本地化工作正常.有人知道我在调试"配置设置中缺少什么吗?
It seems that my localization is working when I deploy the application through iTunes via a distribution certificate, but not when using XCode (Command-R or similar). Does anyone know what I am missing from my Debug configuration settings?
推荐答案
我将回答我自己的问题,并希望能帮助其他人.只需将我的应用程序从手机中删除,然后从头开始重新安装,就可以解决我的问题.我必须彻底删除(包括所有数据),而不仅仅是从Xcode进行清理+重建.
I'm going to answer my own question and hopefully help others. My problem was solved by simply removing my application from the phone and reinstalling it from scratch. I had to do a complete remove (including all data), not just a clean+rebuild from Xcode.
我想iPhone会将可用的本地化存储在某处...
I guess that the iPhone caches the available localizations somewhere...
这篇关于本地化不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!