xcode 如何将 iOS 模拟器永久设置为与英语不同的语言
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7873249/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to permanently set the iOS Simulator to a different language than english
提问by brainray
I'm developing an app that mainly uses the German language. Because of that, I would like to have the iOS Simulator to be set to German language by default. If I start the iOS Simulator having the language of MacOS set to German, the Menu language of the Simulator is German, but the language 'inside' the simulated iOS is English. I know, that I can change the language within the simulated iOS. But thats not what I'm looking for, because after a reset of the simulator I have to set the language again, and also changing the simulated language seems to be very buggy in iOS 4.2 (frequently leading to hard crashes of MacOS).
我正在开发一个主要使用德语的应用程序。因此,我希望将 iOS 模拟器默认设置为德语。如果我启动 iOS 模拟器并将 MacOS 的语言设置为德语,则模拟器的菜单语言是德语,但模拟 iOS 的“内部”语言是英语。我知道,我可以在模拟的 iOS 中更改语言。但这不是我要找的,因为在模拟器重置后,我必须再次设置语言,而且在 iOS 4.2 中更改模拟语言似乎非常有问题(经常导致 MacOS 严重崩溃)。
Is there a way (maybe via the command line) to permanently change the default language of the simulator?
有没有办法(也许通过命令行)永久更改模拟器的默认语言?
Many thanks in advance.
提前谢谢了。
回答by denbec
As seen in the iOS7 TechTalks Video"Hidden iOS Developer Gems", you can set two properties in the build scheme so that the simulator changes to your selected language and region:
如 iOS7 TechTalks 视频“Hidden iOS Developer Gems”中所见,您可以在构建方案中设置两个属性,以便模拟器更改为您选择的语言和区域:
That way you can also easily add multiple run schemes if you need to test different languages each time and quickly switch them before running.
这样,如果您需要每次测试不同的语言并在运行前快速切换它们,您还可以轻松添加多个运行方案。
Edit: As of Xcode 6, you can edit this information directly through the run schemes options. Just select "Application Language" and/or "Application Region".
编辑:从 Xcode 6 开始,您可以直接通过运行方案选项编辑此信息。只需选择“应用程序语言”和/或“应用程序区域”。
回答by Daniel
You could make yourself a script using ios-sim-locale to set simulator options if the locale settings are lost. See ios-sim-locale. This way you only would need to execute the script before starting the simulator.
如果区域设置丢失,您可以使用 ios-sim-locale 为自己制作一个脚本来设置模拟器选项。请参阅ios-sim-locale。这样您只需要在启动模拟器之前执行脚本。