将某些XIB / Storyboard字符串标记为不可本地化 [英] Marking some XIB/Storyboard strings as not localizable
问题描述
我正在使用Base Internationalization for XIB / Storyboard文件和Export for Localization方法,使用XLIFF文件进行翻译。
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.
是否有某种方法可以将此标签的.text属性标记为在XIB中设置为不可本地化,以便它不会以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
并在其结果<$ c之上进行额外处理$ c> .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.
请查看README中的相关部分在GitHub 上获取详细信息。
Please check out out the related section within the README on GitHub for detailed information.
这篇关于将某些XIB / Storyboard字符串标记为不可本地化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!