XCode 5 / iOS 7 - 本地化无法在模拟器中运行 [英] XCode 5/iOS 7 - localization not working in simulator

查看:137
本文介绍了XCode 5 / iOS 7 - 本地化无法在模拟器中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注Ray Wenderlich关于本地化的一个教程,但我似乎无法让它工作。

I was following one of Ray Wenderlich's tutorials on localization but I can't seem to get it working.

我已经将我的项目设置为英语和法语的本地化,并且每个都有一个locaziable.strings文件:

I've set my project up for localization in English and French and I have a locaziable.strings file for each:

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

The French file has the correct (well as far as Google translate goes) French versions of my string:

我通过调用localizable.strings文件中的正确键来设置字符串:

I'm setting the strings by calling the correct key from the localizable.strings file:

 NSString* strTitle = [NSString stringWithFormat:NSLocalizedString(@"Title", Nil)];

我将模拟器设置为法语(BTW:每当我做一个语言更改模拟器崩溃) 。

And I have the simulator set to French (BTW: Whenever I do a language change the simulator crashes).

但它并没有从正确的localizable.strings文件中提取。它仍以英文显示:

But it is not pulling from the correct localizable.strings file. Its still displaying in English:

我做错了吗?

推荐答案

也许你有在文件 Localizable.strings 已经存在但尚未本地化的某个时间运行应用程序。如果是这种情况,这个未本地化的文件仍然驻留在模拟器中的应用程序包中的resources文件夹中(当您在模拟器或设备中构建运行新版本的应用程序时,将不会删除未使用的文件)。这可能会导致问题。

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.

这篇关于XCode 5 / iOS 7 - 本地化无法在模拟器中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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