iOS 应用程序自定义本地化设置
我将制作一个多语言 iPad 应用程序,我希望用户在其中选择首选语言。所以我的问题是,如何在运行时更改应用程序语言?我不想更改 iPad 语言。
I am going to make a multi-langual iPad app, in which I want user to select a preferred langauge. So my question is, how can I change my application language at run-time ? I don't want to change iPad language.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Apple 指南不建议这样做。
我的解决方案(用户应该手动重新启动应用程序;要“动态”处理语言切换,您应该重新加载包括 XIB 在内的所有资源)是:
This is not recommended by Apple guidelines.
My solution (user should restart app manually; to handle the language switch "on fly" you should reload all resources including XIBs) is:
这已经被问过几次了。对此没有很好的解决方案,这很重要(例如,请注意,当您更改语言时,iOS 会重新启动)。有些人通过替换 NSLocalizedString 调用以及更改 NIB 加载来实现此目的,以便他们指定要使用的本地化版本。例如,请参阅另一个SO问题。
This has been asked a few times. There's no great solution for this, it's non-trivial (notice for example that iOS does a restart when you change the language). Some people have achieved this by replacing NSLocalizedString calls and also by changing NIB loading so that they specify the localized version to use. See for example this other SO question.