在运行iOS时,以编程方式动态更改语言 [英] Changing language on the fly, in running iOS, programmatically

查看:246
本文介绍了在运行iOS时,以编程方式动态更改语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经堆叠和谷歌搜索了几个小时。我现在有点绝望了。
我想在应用程序中更改应用程序的语言,而不仅仅是使用默认语言。

I've been stackling and googling for hours. And I'm kind of desperate now. I would like to change the language of my application inside the app not only with the default language.

从我尝试过的事情中,我就像所有人一样重启步骤。意思是,苹果强制您手动重启应用程序。意思是你必须退出应用程序,然后重新启动它。

From what I've tried I stuck like everybody with the reboot step. Meaning, apples forces you to restart the app manually. Meaning you have to quit the app and then starting it up again.

好吧,谷歌搜索后,我试图设置一个警报,然后强迫应用程序退出

Well, after googling, I was trying to setup an alarm and then forcing later the app to exit with

exit(0);

我的不好,苹果似乎不喜欢这样,并阻止开发者使用它...我猜我我没有指向正确的方向。

My bad, apple seems not to like this and prevent developer from using it... I guess I'm not pointing in the right direction.

最后,尽管存在所有问题,我还是可以见面,我想讨论一下。

Finally, despite all the problem, I could meet I would like to discuss about that.

任何提示?

编辑,来自APPLE的信息


一般情况下,你不应该从内部更改
iOS系统语言(通过使用
AppleLanguages pref键)
你的申请。这与用于在设置应用中切换
语言的基本iOS用户模型相比,

也使用了不是
记录的首选键,这意味着在某些时候$ b将来$ b,密钥名称可以
更改,这将破坏你的
申请。

In general, you should not change the iOS system language (via use of the AppleLanguages pref key) from within your application. This goes against the basic iOS user model for switching languages in the Settings app, and also uses a preference key that is not documented, meaning that at some point in the future, the key name could change, which would break your application.

如果你想在$ b中切换语言$ b你的应用程序,你可以通过
手动加载
你的包中的资源文件。您可以使用
NSBundle:pathForResource:ofType:inDirectory:forLocalization:
用于此目的,但请记住
您的应用程序将是
负责所有加载
本地化数据。

If you want to switch languages in your application, you can do so via manually loading resource files in your bundle. You can use NSBundle:pathForResource:ofType:inDirectory:forLocalization: for this purpose, but keep in mind that your application would be responsible for all loading of localized data.

关于退出(0)问题,Apple
DTS无法对应用批准
流程发表评论。你应该联系
appreview@apple.com来获得这个问题的答案

Regarding the exit(0) question, Apple DTS cannot comment on the app approval process. You should contact appreview@apple.com to get an answer for this question.

好吧,我必须选择到目前为止。

Well, I have to choose so far.

推荐答案

这是一个相当古老的问题,但我只是在努力解决同样的问题,并发现这一点解决方案:

This is a fairly old question, but I was just struggling with the same problem and found this solution:

http://aggressive-mediocrity.blogspot.com/2010/03/custom-localization-system-for-your.html

您的确需要什么(对于遇到同样问题的人可能会有所帮助:)

Which does exactly what you need (and might be helpful for others who with the same problem :)

这篇关于在运行iOS时,以编程方式动态更改语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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