Xcode 5/iOS 7 - 本地化在模拟器中不起作用 [英] Xcode 5/iOS 7 - localization not working in simulator

查看:27
本文介绍了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:

法语文件有我的字符串的正确(以及谷歌翻译)法语版本:

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)];

而且我将模拟器设置为法语(顺便说一句:每当我更改语言时,模拟器就会崩溃).

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. It's still displaying in English:

我做错了吗?

推荐答案

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

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天全站免登陆