问题描述
我正在使用 Xcode 的 Editor >导出本地化...
导出 XLIFF 文件进行翻译但是 Main.storyboard 的翻译包含许多不必要的字符串,主要是在设计时有用的占位符/虚拟字符.
I'm using the Xcode's Editor > Export For Localization...
to export XLIFF file for translationbut the translations for the Main.storyboard includes a lot of unnecessary strings, mostly placeholders/dummies that are useful at design time.
如何从 XLIFF 文件中排除此类字符串?
How do I exclude such strings from XLIFF file?
推荐答案
我写了一个 脚本 排除某些翻译.
它是如何工作的?
命令行:python strip_loc.py input.xliff output.xliff exclude_list.txt [-v]
示例用法:python strip_loc.py en.xliff en-stripped.xliff exclude_words.txt -v
exclude_list.txt 是每行一个字符串的文件.该脚本解析这个列表并创建一个禁用词词典.如果遇到包含这些字符串之一的源的翻译,则整个翻译单元将从输出 xml/xliff 中删除.
I've written a script that excludes certain translation.
How it works?
cmd-line: python strip_loc.py input.xliff output.xliff exclude_list.txt [-v]
Example usage:python strip_loc.py en.xliff en-stripped.xliff exclude_words.txt -v
The exclude_list.txt is a file with a string per line. The script parses this list and creates a dictionary of banned words. If a translation with source containing one of these strings is encountered, the whole translation unit is removed from the output xml/xliff.
这篇关于从 Xcode 导出 XLIFF 时,如何排除虚拟字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!