xcode 为什么我不能向我的 iOS 应用程序添加本地化?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11833821/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 01:09:08  来源:igfitidea点击:

Why can't I add localization to my iOS app?

iosxcodelocalization

提问by Boris Mossounov

I'm trying to add a localization. I've read all those localization/internationalization guides from Apple and raywenderlich.com. I've marked all my code with NSLocalizedString macro, I've used genstrings to create Localizable.strings. But somehow I'm missing some important step.

我正在尝试添加本地化。我已经阅读了来自 Apple 和 raywenderlich.com 的所有本地化/国际化指南。我已经用 NSLocalizedString 宏标记了我的所有代码,我已经使用 genstrings 来创建 Localizable.strings。但不知何故,我错过了一些重要的步骤。

When I try to add localization to my Localizable.strings I'm somehow restricted to English only.

当我尝试将本地化添加到我的 Localizable.strings 时,我以某种方式仅限于英语。

When I try to add localization to project via "Editor"->"Add Localization" all language options are disabled.

当我尝试通过“编辑器”->“添加本地化”向项目添加本地化时,所有语言选项都被禁用。

Does anybody have any thoughts as to why am I restricted to English only? What have I missed?

有没有人对为什么我只能使用英语有任何想法?我错过了什么?

I've tried to add localization to other projects with the same result. :(

我尝试将本地化添加到具有相同结果的其他项目。:(

回答by Jesse Rusak

You need to first add your localizations to your project. Click on the project file, ensure that the project, not the target, is selected in the middle pane and then choose the "Info" screen. There's a area called "Localizations" where you can add languages. You should then be able to localize your resources.

您需要首先将本地化添加到您的项目中。单击项目文件,确保在中间窗格中选择了项目,而不是目标,然后选择“信息”屏幕。有一个名为“本地化”的区域,您可以在其中添加语言。然后,您应该能够本地化您的资源。

Important pieces

重要作品

回答by Bruno Cunha

Another possible issue is that you are not selecting appropriately the project, which leads to all languages in the Add localizationlist being disabled.

另一个可能的问题是您没有正确选择项目,这会导致添加本地化列表中的所有语言都被禁用。

By default the target may be selected, make sure you select the project instead. Then you can use the Add localizationnormally.

默认情况下可能会选择目标,请确保选择项目。然后就可以正常使用添加本地化了

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

回答by Henk-Martijn

Something which kept me busy for too long. I looked over the language I needed (Swedish) in the first list and took the one from the "Other" list. Well my phone or emulator didn't change at all to Swedish. But when I took Swedish from the first list it got nicely updated when changing the language settings.

有件事让我忙了太久。我查看了第一个列表中我需要的语言(瑞典语)并从“其他”列表中选择了一个。好吧,我的手机或模拟器根本没有更改为瑞典语。但是当我从第一个列表中选择瑞典语时,它在更改语言设置时得到了很好的更新。

enter image description here

在此处输入图片说明

回答by Sea Coast of Tibet

With Xcode 6, you can do it via Project Settings.

使用 Xcode 6,您可以通过项目设置来完成。