删除 PO 文件的所有模糊条目
有谁知道从 PO 文件中批量删除所有模糊翻译的方法。类似于:
if #, fuzzy == TRUE then SET msgstr="" AND REMOVE #, fuzzy
Does anyone know a method to mass delete all fuzzy translations from a PO file. Something like:
if #, fuzzy == TRUE Then SET msgstr="" AND REMOVE #, fuzzy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是 Python 中用于处理 gettext po 文件的库:
您可以使用 polib 删除模糊字符串,这 脚本删除模糊翻译字符串+模糊标志,但保持未翻译的原始 msgids 完整。有些语言(ru、cz、...)有两个以上的复数形式,因此,我们检查 msgstr_plural[2]。对于旧版本的 polib,
msgstr_plural
的索引是一个字符串,因此这将变为msgstr_plural['2']
。You can remove fuzzy strings with polib, which is THE library in Python for working with gettext po files:
This script removes the fuzzy translation strings + fuzzy flags, but keeps the untranslated original msgids intact. Some languages (ru, cz, ...) have more than two plural forms, therefore, we check on msgstr_plural[2]. With older versions of polib, the index to
msgstr_plural
is a string, so this would becomemsgstr_plural['2']
.如果您安装了 GNU gettext,那么您可以使用此命令来删除模糊消息:
If you have GNU gettext installed then you can use this command to remove fuzzy messages:
如果安装了 gettext,您可以使用 msgattrib 命令来完成此操作:
msgattrib 的完整文档位于:
https://www.gnu.org/software/gettext/manual/html_node/msgattrib-Inspiration.html
If gettext is installed you can use the msgattrib command to accomplish this:
The full documentation for msgattrib is here:
https://www.gnu.org/software/gettext/manual/html_node/msgattrib-Invocation.html