英文:
How to remove old (out commented) msgid from po files?
问题
在我的Python代码中,我将_("Every 30 minutes")
修改为_("Every {n} minutes").format(...)
。通过使用xgettext
更新pot
(po模板)的工作效果很好。旧的msgid完全消失在该文件中,新的msgid出现。
但是,接下来通过使用msgmerge --update
基于pot
更新我的po
文件让我感到困惑。旧的msgid并没有消失,而只是被注释掉了。
#~ msgid "Every 30 minutes"
我能否在某种程度上影响这种行为,防止msgmerge
创建它们?
英文:
I'm quite new to the GNU gettext tools. So please feel free to correct me if I use the wrong terms.
In my Python code I modified _("Every 30 minutes")
to _("Every {n} minutes").format(...)
.
Updating the pot
(po-template) via xgettext
worked well. The old msgid totally disapeared in that file and the new msgid appeared.
But then updating my po
files based on the pot
(using msgmerge --update
) do confuse me. The old msgid do not disappear but is just out commented.
#~ msgid "Every 30 minutes"
Can I influence that behaviour somehow and prevent msgmerge
from creating them?
答案1
得分: 1
我认为 msgfmt
没有这样的选项,但所有过时的条目 - 这就是它们的称呼 - 都位于文件的末尾,您可以轻松使用文本编辑器将它们删除。
过时的条目保留在 .po
文件中,因为它们随时可以重新激活,当涉及到的消息再次出现在您的源代码中时。同样,如果新字符串类似于过时的字符串,它们可以用作模糊条目的基础。出于这个原因,大多数人保留了过时的条目。
英文:
I think there is no such option to msgfmt
but all obsolete entries - that is what they are called - are at the end of the file and you can easily remove them with a text editor.
Obsolete are kept in the .po
file because they can always be re-activated, when the message in question re-appears in your sources. Likewise, they can be used as the base for a fuzzy entry if a new string resembles an obsolete one. Most people keep the obsolete entries for that reason.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论