Search code examples
pythongettext

How to remove old (out commented) msgid from po files?


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?


Solution

  • 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.