从 Xcode 导出 XLIFF 时,如何排除虚拟字符串? [英] When exporting XLIFF from Xcode, how to exclude dummy strings?

查看:18
本文介绍了从 Xcode 导出 XLIFF 时,如何排除虚拟字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Xcode 的 Editor >导出本地化... 导出 XLIFF 文件进行翻译但是 Main.storyboard 的翻译包含许多不必要的字符串,主要是在设计时有用的占位符/虚拟字符.

I'm using the Xcode's Editor > Export For Localization... to export XLIFF file for translation but 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 时,如何排除虚拟字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆