Pru*_*goe 28 xcode localization ios ios-simulator ios7
我正在关注Ray Wenderlich关于本地化的一个教程,但我似乎无法让它工作.
我已经将我的项目设置为英语和法语本地化,并且每个都有一个locaziable.strings文件:

法语文件有正确的(就Google翻译而言)我的字符串的法语版本:

我通过调用localizable.strings文件中的正确键来设置字符串:
NSString* strTitle = [NSString stringWithFormat:NSLocalizedString(@"Title", Nil)];
Run Code Online (Sandbox Code Playgroud)
我将模拟器设置为法语(BTW:每当我做一个语言改变模拟器崩溃).
但它并没有从正确的localizable.strings文件中提取.它仍然以英文显示:

难道我做错了什么?
The*_*heo 24
Maybe you have run the app at some time where the file Localizable.strings already existed but has not been localized yet. If this is the case, this unlocalized file still resides in the resources folder in the application bundle in the simulator (when you build an run a new version of your app in the simulator or in the device, unused files will not be deleted). This can lead to problems.
Try to delete the app completely from the simulator and build an run again.
Vik*_*era 12
我在设备上遇到过类似的问题(在我的情况下是IB本地化).所以一般的答案是
设备 - 按Shift + CMD + K卸载应用程序并清理项目
模拟器 - 转到iOS模拟器>重置内容和设置并按Shift + CMD + K清理项目
这些问题真的很烦人.随着更新本地化字符串的能力差,本地化是iOS开发的最大缺点之一.
小智 11
可能导致本地化不起作用的另一个问题是字符串文件的编码.Localizable.strings的编码必须是UTF-16.xcode中文本文件的默认编码是UTF-8,这使我花了一整天的时间来检查本地化不起作用的原因.
| 归档时间: |
|
| 查看次数: |
22753 次 |
| 最近记录: |