简体   繁体   English

如果我以编程方式完成所有布局,是否需要启用 Base Internationalization?

[英]Do I need to enable Base Internationalization if I do all layouts programmatically?

I'm coding an iPhone/iPad App in Obj-C.我正在用 Obj-C 编写 iPhone/iPad 应用程序。 From the beginning, I've coded all my layouts (I use Auto Layout) programmatically.从一开始,我就以编程方式编写了所有布局(我使用自动布局)。

So, now I'm coming to where I want to Internationalize my App and I keep seeing that I need to turn on Base Internationalization .所以,现在我要对我的应用程序进行国际化,我一直看到我需要打开Base Internationalization

But, when I read about Base Internationalization does, I read that Base Internationalization separates user-facing code from .storyboard and .xib files.但是,当我阅读Base Internationalization 时,我读到 Base Internationalization 将面向用户的代码与 .storyboard 和 .xib 文件分开。

I have no .storyboard or .xib files.我没有 .storyboard 或 .xib 文件。 All my user-facing strings make use of NSLocalizedString.我所有面向用户的字符串都使用 NSLocalizedString。

My tentative conclusion is that I don't need to enable Base Internationalization but I want to put this out here as a question in case I'm missing something.我的初步结论是我不需要启用Base Internationalization,但我想把它作为一个问题放在这里,以防我遗漏了什么。

You do not need base internationalization if all your strings are already in your code.不需要基地国际化,如果您的所有字符串已经在你的代码。

You have basically already done the work that base internationalization would have done for you.您基本上已经完成了基础国际化将为您完成的工作。 It would have extracted text from the .xib and .storyboard files and created .strings files to then add the text back via NSLocalizedString.它会从 .xib 和 .storyboard 文件中提取文本并创建 .strings 文件,然后通过 NSLocalizedString 添加文本。

You can avoid the Xcode warning by checking base internationalization, as there will be no resources to extract strings from.您可以通过检查基本国际化来避免 Xcode 警告,因为将没有可从中提取字符串的资源。 It simply creates a new language folder named Base.lproj from which any language is then derived.它只是创建一个名为 Base.lproj 的新语言文件夹,然后从中派生出任何语言。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM