gh-131852: Filter out POT-Creation-Date in msgfmt (GH-131880)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
This commit is contained in:
Stan Ulbrych 2025-04-05 20:38:39 +01:00 committed by GitHub
parent 376631829a
commit ad6a032ceb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 3 deletions

View file

@ -158,14 +158,19 @@ def make(filename, outfile):
msgctxt = b''
elif l.startswith('msgid') and not l.startswith('msgid_plural'):
if section == STR:
add(msgctxt, msgid, msgstr, fuzzy)
msgctxt = None
if not msgid:
# Filter out POT-Creation-Date
# See issue #131852
msgstr = b''.join(line for line in msgstr.splitlines(True)
if not line.startswith(b'POT-Creation-Date:'))
# See whether there is an encoding declaration
p = HeaderParser()
charset = p.parsestr(msgstr.decode(encoding)).get_content_charset()
if charset:
encoding = charset
add(msgctxt, msgid, msgstr, fuzzy)
msgctxt = None
section = ID
l = l[5:]
msgid = msgstr = b''