问题描述
我正在为 XIB/Storyboard 文件使用 Base Internationalization,并为翻译人员使用 XLIFF 文件的Export for Localization"方法.
I am using Base Internationalization for XIB/Storyboard files and the "Export for Localization" method using XLIFF files for translators.
我有一些标签、按钮等包含需要翻译的文本,但我也有一些标签,我们在其中使用了一些占位符文本(如全名),这样您就可以看到填充后视图的样子带有数据,但这些标签的文本始终以编程方式来自插座.
I have some labels, buttons, etc. that have text that should be translated, but I also have labels where we use some placeholder text (like a full-name) so you can see what the view would look like when populated with data, but those labels always have their text come from an outlet programmatically.
有没有办法将此标签在 XIB 中设置的 .text 属性标记为不可本地化,这样它就不会出现在 XLIFF(或生成的 .strings)文件中.
Is there some way to mark this label's .text property that is set in the XIB as non-localizable so that it doesn't end up in the XLIFF (or resulting .strings) files.
我知道我可以删除文本——我还考虑过使用前缀(如@!DNL!")来表示翻译人员不应该进行本地化,但我希望只有一种标准方式这样做.
I know that I can remove the text -- I also thought about having a prefix (like @"!DNL!") to mean that the translator shouldn't localize, but I am hoping that there is just a standard way to do this.
推荐答案
现在可以使用 BartyCrouch 我最近编写的用于解决 这个问题(请参阅该线程上我的答案中的安装说明).
This is now possible using the BartyCrouch command line utility which I recently wrote to solve this problem (see installation instructions in my answer on that thread).
BartyCrouch 为您运行 ibtool
并在其生成的 .strings
文件之上进行额外处理.如果您将 #bc-ignore!
包含在您的值或基本国际化 Storyboard/XIB 文件中的注释中,它将从翻译中排除视图.
BartyCrouch runs ibtool
for you and does additional processing on top of its resulting .strings
file. It will exclude views from translation if you include #bc-ignore!
into your value or comment within your base internationalized Storyboard/XIB file.
请查看自述文件中的 相关部分在 GitHub 上 了解详细信息.
Please check out out the related section within the README on GitHub for detailed information.
这篇关于将某些 XIB/Storyboard 字符串标记为不可本地化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!