8000 gh-131852: Filter out POT-Creation-Date in ``msgfmt`` by StanFromIreland · Pull Request #131880 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-131852: Filter out POT-Creation-Date in msgfmt #131880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 5, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use re to keep final '\n'
  • Loading branch information
StanFromIreland committed Mar 29, 2025
commit adcd53399079cfd19766eb79ba50fcf84c9d1e66
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\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"
"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"
],
[
"\n newlines \n",
Expand Down
Binary file modified Lib/test/test_tools/msgfmt_data/general.mo
Binary file not shown.
10 changes: 6 additions & 4 deletions Tools/i18n/msgfmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,12 @@ def make(filename, outfile):
if not msgid:
# Filter out POT-Creation-Date
# See issue #131852
msgstr = "\n".join(
line
for line in msgstr.decode(encoding).splitlines()
if not line.startswith("POT-Creation-Date:")
import re
msgstr = re.sub(
r"^POT-Creation-Date:.*(?:\n|$)",
"",
msgstr.decode(encoding),
flags=re.MULTILINE,
).encode(encoding)

# See whether there is an encoding declaration
Expand Down
Loading
0