Skip to content

Commit ad6a032

Browse files
StanFromIrelandtomasr8
andauthoredApr 5, 2025
gh-131852: Filter out POT-Creation-Date in msgfmt (GH-131880)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
1 parent 3766318 commit ad6a032

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed
 

‎Lib/test/test_tools/msgfmt_data/general.json

+1-1
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 <LL@li.org>\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 <LL@li.org>\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n"
55
],
66
[
77
"\n newlines \n",
-41 Bytes
Binary file not shown.
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

+7-2
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,19 @@ 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 = b''.join(line for line in msgstr.splitlines(True)
165+
if not line.startswith(b'POT-Creation-Date:'))
166+
164167
# See whether there is an encoding declaration
165168
p = HeaderParser()
166169
charset = p.parsestr(msgstr.decode(encoding)).get_content_charset()
167170
if charset:
168171
encoding = charset
172+
add(msgctxt, msgid, msgstr, fuzzy)
173+
msgctxt = None
169174
section = ID
170175
l = l[5:]
171176
msgid = msgstr = b''

0 commit comments

Comments
 (0)