Can't choose "More" when choosing application language in Edit Scheme

时间:2019-04-17 02:24:03

标签: ios xcode localization

I'm trying to account for both English and Georgian and an app I'm developing. I had added the localization language to the project, have all the storyboard languages setup and the strings files.

I now want to test to see if the text translates correctly.

However, when I go to Edit Scheme and find the application language drop down it doesn't have Georgian.

When I added the localization in the project settings I could go to a More menu that had LOADS of languages. Why does this not exist in the Application Language drop down in the scheme settings?

enter image description here

EDIT:

Tried the solution below by adding language and locale as arguments:

enter image description here

I have what I believe is the correct setup for translating strings depending on the language of the phone etc.

enter image description here

1 个答案:

答案 0 :(得分:1)

Xcode方案的Debug选项仅包含一部分语言以及用于测试的伪语言。但是,有解决方法。

如果要查看文本翻译是否正确,请执行以下一项操作:

  1. 转到方案的“参数”标签,并将AppleLanguagesAppleLocale添加到“启动时传递的参数”部分。

    例如,要选择格鲁吉亚语言和格鲁吉亚地区,您可以添加:

  -AppleLanguages "(ka-GE)"
  -AppleLocale "GEO"

或:

  1. 在设备或模拟器上,在设备的“偏好设置”中设置区域和语言,然后运行您的应用。

更多内容:Internationalization and Localization Guide

请注意,佐治亚州的ISO语言代码是“ ka-GE”,而不是“ ge”。您应该将“ ka-GE.lproj”作为本地化文件夹名称。

语言代码来自此处的ISO代码:ISO 639-2 codes,区域代码来自这些:ISO_3166-2 codes

我刚注意到的另一件事是您的字符串翻译文件称为“ Localize.strings”。默认文件名是“ Localizable.strings”,如果您调用NSLocalizedString时未在可选的table参数中提供显式文件名,则iOS会查找该文件名。因此,您可能需要重命名翻译文件才能正常工作。