Xcode - 从本地化中排除某些字符串

时间:2015-08-05 23:31:07

标签: ios xcode macos localization uistoryboard

在本地化我的故事板时,我的字符串文件中的条目看起来像:

/* Class = "NSTextFieldCell"; title = "Text Cell"; ObjectID = "vHF-LZ-23i"; */ "vHF-LZ-23i.title" = "Text Cell";

有没有将虚拟文本或其他字符串排除在故事板本地化字符串文件中?

1 个答案:

答案 0 :(得分:3)

正如Jenszcz在他的评论中提到的那样,你可以通过使用BartyCrouch开源项目来解决这个问题,我很乐意尝试一下并且工作得非常好:)以下是我为使其工作而采取的步骤在5分钟内。

1-安装BartyCrouch。请参阅url。

中的安装过程

2-创建了一个示例项目,您可以访问here。在该项目中创建了2个标签(“包含文本”和“文本排除#bc-ignore!”)。

3-添加RunScript(有关如何添加构建脚本的说明here

if which bartycrouch > /dev/null; then
    bartycrouch update -x
    bartycrouch lint -x
else
    echo "warning: BartyCrouch not installed, download it from https://github.com/Flinesoft/BartyCrouch"
fi

enter image description here

4-构建项目后,Main.strings文件排除了一个标签。这里是显示故事板文件和屏幕截图的屏幕截图。 .strings文件。 enter image description here enter image description here