Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/test/test_tools/msgfmt_data/general.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
[
"",
"Project-Id-Version: PACKAGE VERSION\nPOT-Creation-Date: 2024-10-26 18:06+0200\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME <EMAIL@ADDRESS>\nLanguage-Team: LANGUAGE <[email protected]>\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n"
"Project-Id-Version: PACKAGE VERSION\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME <EMAIL@ADDRESS>\nLanguage-Team: LANGUAGE <[email protected]>\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n"
],
[
"\n newlines \n",
Expand Down
Binary file modified Lib/test/test_tools/msgfmt_data/general.mo
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
:program:`msgfmt` no longer adds the ``POT-Creation-Date`` to generated ``.mo`` files
for consistency with GNU ``msgfmt``.
9 changes: 7 additions & 2 deletions Tools/i18n/msgfmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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''
Expand Down
Loading