如何在 xcode 5 和 ios 7 中设置默认语言环境?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21167559/
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 do I set the default locale in xcode 5 and ios 7?
提问by allemattio
I know this is an already asked question, but no one of the answers helped me.
我知道这是一个已经提出的问题,但没有一个答案对我有帮助。
I'm writing an iOS app localized in italian and english.
我正在编写一个用意大利语和英语本地化的 iOS 应用程序。
I've already done two storyboards and two Localizable.strings file for the texts.
我已经为文本制作了两个故事板和两个 Localizable.strings 文件。
Now, if I set the english language on the phone, the app picks the english files, if I set the italian language on the phone the app picks the italian files.
现在,如果我在手机上设置英语,应用程序会选择英语文件,如果我在手机上设置意大利语,应用程序会选择意大利语文件。
But if I set french language(or spanish, or german), the app picks the italian files, which is wrong, how can I set english as the default language?
但是如果我设置法语(或西班牙语或德语),应用程序会选择意大利语文件,这是错误的,我如何将英语设置为默认语言?
回答by James Frost
An iOS device keeps track of which languages you have set the locale to. If the currently selected locale is unsupported in an app, then the device will use the last user-selected language you used that is supported by the application.
iOS 设备会跟踪您将区域设置设置为哪些语言。如果应用程序不支持当前选择的区域设置,则设备将使用应用程序支持的您上次使用的用户选择的语言。
So for example, imagine you had changed your device to English, then Italian, then Spanish. The app would first try and provide a Spanish localization. If one wasn't available, it would attempt Italian. If thatwasn't available, then it would finally use English.
例如,假设您已将设备更改为英语,然后是意大利语,然后是西班牙语。该应用程序将首先尝试提供西班牙语本地化。如果没有,它会尝试意大利语。如果那不可用,那么它最终会使用英语。
If you view the list of languages in the device's Settings, you'll see that they're ordered by 'last used'. I'm not aware of any way to alter this (seemingly intentional) feature.
如果您在设备的设置中查看语言列表,您会看到它们是按“上次使用”排序的。我不知道有什么方法可以改变这个(看似有意的)功能。