问题描述
我正在使用Xcode的Editor > Export For Localization...
导出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?
推荐答案
我写了一个脚本,不包括某些翻译.
它如何工作?
cmd行:python strip_loc.py 输入 .xliff 输出 .xliff 排除列表 .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时,如何排除虚拟字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!