Skip to content

Commit ed0342c

Browse files
Filter out POT-Creation-Date
1 parent d260631 commit ed0342c

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

Lib/test/test_tools/msgfmt_data/general.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[
22
[
33
"",
4-
"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"
4+
"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"
55
],
66
[
77
"\n newlines \n",
-42 Bytes
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:program:`msgfmt` no longer adds the ``POT-Creation-Date`` to generated ``.mo`` files
2+
for consistency with GNU ``msgfmt``.

Tools/i18n/msgfmt.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,22 @@ def make(filename, outfile):
158158
msgctxt = b''
159159
elif l.startswith('msgid') and not l.startswith('msgid_plural'):
160160
if section == STR:
161-
add(msgctxt, msgid, msgstr, fuzzy)
162-
msgctxt = None
163161
if not msgid:
162+
# Filter out POT-Creation-Date
163+
# See issue #131852
164+
msgstr = "\n".join(
165+
line
166+
for line in msgstr.decode(encoding).splitlines()
167+
if not line.startswith("POT-Creation-Date:")
168+
).encode(encoding)
169+
164170
# See whether there is an encoding declaration
165171
p = HeaderParser()
166172
charset = p.parsestr(msgstr.decode(encoding)).get_content_charset()
167173
if charset:
168174
encoding = charset
175+
add(msgctxt, msgid, msgstr, fuzzy)
176+
msgctxt = None
169177
section = ID
170178
l = l[5:]
171179
msgid = msgstr = b''

0 commit comments

Comments
 (0)