为什么我的文件没有进入“en.lproj”,而是在 Xcode 中的“Make file Localizable”之后进入新的“English.lproj”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7051120/
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
Why doesn't my file move into "en.lproj" but instead into a new "English.lproj" after "Make file Localizable" in Xcode?
提问by openfrog
This is a bit confusing:
这有点令人困惑:
First I used genstrings, which created me a Localizable.strings file inside an en.lprojfolder (also exists on the file system like that).
首先,我使用了 genstrings,它在en.lproj文件夹中创建了一个 Localizable.strings 文件(也存在于这样的文件系统中)。
Then I had a JSON file which I wanted to localize, so I opened the info-pane for that file and choose "Make File Localizable". Xcode then created an English.lprojfolder on the file system and also a group called like this. It then moved my file into there.
然后我有一个想要本地化的 JSON 文件,所以我打开了该文件的信息窗格并选择“使文件可本地化”。Xcode 然后在文件系统上创建了一个English.lproj文件夹,还有一个这样的组。然后它将我的文件移到那里。
So now I ended up having en.lprojand English.lprojfor basically the same thing: English stuff.
所以现在我最终将en.lproj和English.lproj用于基本相同的事情:英语内容。
I'm not happy with this situation. Can / should I do anything about it? How can I fix that?
我对这种情况并不满意。我可以/应该做些什么吗?我该如何解决?
Also, can someone point out what's the difference between using "English.lproj" vs. "en.lproj"? I bet there isa difference.
另外,有人可以指出使用“English.lproj”与“en.lproj”之间的区别吗?我敢打赌是有区别的。
回答by memmons
It's an Xcode bug. Just move everything in the English.lproj
folder to en.lproj
folder. I haven't checked with Xcode 4.1, but previous versions of Xcode wouldn't allow you to add new localizations if you delete the English.lproj
folder, so don't delete it.
这是一个 Xcode 错误。只需将English.lproj
文件en.lproj
夹中的所有内容移动到文件夹即可。我没有检查过 Xcode 4.1,但是如果您删除English.lproj
文件夹,以前版本的 Xcode 不允许您添加新的本地化,所以不要删除它。
You could manually edit your project file to avoid the problem as this post suggest, but I've never really found doing so to be worth it.
您可以手动编辑您的项目文件以避免出现本文所建议的问题,但我从未真正发现这样做值得。
Some background -- prior to Max OS X 10.4 the legacy (but more user-readable) names such as “English”, “Spanish”, etc., were used, but the Apple internationalization documentationstates that these values are now deprecated:
一些背景——在 Max OS X 10.4 之前,使用了旧的(但更易读的)名称,如“English”、“Spanish”等,但Apple 国际化文档指出这些值现在已被弃用:
In addition to the ISO language designators, the bundle routines also recognize several legacy language designators. These designators let you specify a language by a user-readable name, instead of by a two or three character code. Designators included names such as English, French, German, Japanese, Chinese, Spanish, Italian, Swedish, and Portuguese among others. Although these names are still recognized and processed by the NSBundle class and Core Foundation bundle functions, their use is deprecated and support for them in future versions of Mac OS X or iPhone OS is not guaranteed. Use the codes described in “Language Designations” and “Regional Designations” instead.
除了 ISO 语言指示符之外,捆绑例程还识别多个遗留语言指示符。这些指示符允许您通过用户可读的名称而不是两个或三个字符的代码来指定语言。指示符包括英语、法语、德语、日语、中文、西班牙语、意大利语、瑞典语和葡萄牙语等名称。尽管 NSBundle 类和 Core Foundation 捆绑函数仍然可以识别和处理这些名称,但不推荐使用它们,并且不能保证在未来版本的 Mac OS X 或 iPhone OS 中支持它们。请改用“语言名称”和“地区名称”中描述的代码。
回答by SideSwipe
You should use ISO-639-1 (two-letter) or ISO-639-2 (three-letter) language codes codes for localization purposes of all languages other than English. XCode still uses “English” instead of “en” as their default localization.
您应该使用 ISO-639-1(两个字母)或 ISO-639-2(三个字母)语言代码用于除英语之外的所有语言的本地化目的。XCode 仍然使用“English”而不是“en”作为它们的默认本地化。
See http://eschatologist.net/blog/?p=224for info.
有关信息,请参阅http://eschatologist.net/blog/?p=224。