ios 在 Xcode 中更改开发语言
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25871815/
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
Changing the development language in Xcode
提问by AppsDev
I need to set Spanish as development language for an iOS app. I'm already using Xcode 6, and I changed the Localization native development region
entry in app's Info.plist
(CFBundleDevelopmentRegion
) from "en" to "es". However, in Project > Info > Localizations, English remains set as Development Language.
我需要将西班牙语设置为 iOS 应用程序的开发语言。我已经在使用 Xcode 6,并且我将Localization native development region
应用程序Info.plist
( CFBundleDevelopmentRegion
) 中的条目从“en”更改为“es”。但是,在项目 > 信息 > 本地化中,英语仍然设置为开发语言。
As said in Information Property List Key Reference, CFBundleDevelopmentRegion
specifies the default language. I need to set Spanish to the default language, what am I missing?
如信息属性列表键参考中所述,CFBundleDevelopmentRegion
指定默认语言。我需要将西班牙语设置为默认语言,我错过了什么?
Thanks
谢谢
回答by lensovet
Here's how you can do this:
以下是您可以这样做的方法:
- Add the language you want to be your Base language first. Uncheckall of the files that Xcode offers to localize for you.
- In the
Info.plist
, change the development region to the language that you want to be your base language. Note that the property is a bit misnamed, because its value should be a language code(with an optional country code), rather than a region or country code. - Close your project in Xcode. In another code editor, open
projectname.xcodeproj/project.pbxproj
and search fordevelopmentRegion
. You should see a line likedevelopmentRegion = English;
. Change this to reference the same language you put in yourInfo.plist
file. - Reopen the project in Xcode. Go through all your localizable files and check the boxes next to English to generate the localizable resources. Note that for storyboards and xibs, Xcode might create a storyboard instead of a strings file. If that happens, just change the filetype to strings file.
- 首先添加要作为基本语言的语言。取消选中Xcode 为您提供本地化的所有文件。
- 在 中
Info.plist
,将开发区域更改为您希望作为基础语言的语言。请注意,该属性的名称有点错误,因为它的值应该是语言代码(带有可选的国家/地区代码),而不是地区或国家/地区代码。 - 在 Xcode 中关闭您的项目。在另一个代码编辑器中,打开
projectname.xcodeproj/project.pbxproj
并搜索developmentRegion
. 你应该看到像developmentRegion = English;
. 将此更改为引用您放入Info.plist
文件中的相同语言。 - 在 Xcode 中重新打开项目。浏览所有可本地化的文件并选中英语旁边的框以生成可本地化的资源。请注意,对于故事板和 xib,Xcode 可能会创建故事板而不是字符串文件。如果发生这种情况,只需将文件类型更改为字符串文件。
Here's an example of the result for me using fr
as the Base language:
这是我fr
用作基本语言的结果示例:
回答by ahbou
For Xcode 9 through 11:
对于 Xcode 9 到 11:
Close Xcode.
关闭 Xcode。
- Open your project.pbxproj in a text editor
- Look for developmentRegionand set its value (es for spanish, fr for french,...)
- Look for knownRegionsand add the new language to the list
- 在文本编辑器中打开您的 project.pbxproj
- 查找developmentRegion并设置其值(es 代表西班牙语,fr 代表法语,...)
- 查找knownRegions并将新语言添加到列表中
Open Xcode: Your project info should now show the language name with Development Language next to it.
打开 Xcode:您的项目信息现在应该显示语言名称,旁边带有 Development Language。
回答by Elwisz
In your project's .xcodeproj file, search for the string developmentRegion
. Supposedly, it says "English" right now. If you change it to "Spanish", Xcode 6 should recognize Spanish as your project's default localization language in the "Info" tab as long as you add "Spanish" to the list.
在项目的 .xcodeproj 文件中,搜索字符串developmentRegion
。据说,它现在说“英语”。如果您将其更改为“西班牙语”,只要您将“西班牙语”添加到列表中,Xcode 6 就会在“信息”选项卡中将西班牙语识别为您项目的默认本地化语言。
You can read more about this topic at http://eschatologist.net/blog/?p=224
您可以在http://eschatologist.net/blog/?p=224 上阅读有关此主题的更多信息
回答by AleyRobotics
open your target -> info -> change "Localization native development region"to your language
打开您的目标 -> 信息 -> 将“本地化本地开发区域”更改为您的语言