Skip to content

gh-130647: Add --omit-header option to pygettext - #130650

Merged
StanFromIreland merged 9 commits into
python:mainfrom
StanFromIreland:omit-header
Aug 20, 2026
Merged

gh-130647: Add --omit-header option to pygettext#130650
StanFromIreland merged 9 commits into
python:mainfrom
StanFromIreland:omit-header

Conversation

@StanFromIreland

@StanFromIreland StanFromIreland commented Feb 27, 2025

Copy link
Copy Markdown
Member

@tomasr8
tomasr8 self-requested a review February 27, 2025 19:20
@StanFromIreland

Copy link
Copy Markdown
Member Author

Also @serhiy-storchaka

@tomasr8

This comment was marked as off-topic.

@StanFromIreland

Copy link
Copy Markdown
Member Author

Anything else left to do here @tomasr8 ?

Comment thread Lib/test/test_tools/test_i18n.py Outdated
Comment thread Tools/i18n/pygettext.py Outdated
Comment thread Tools/i18n/pygettext.py Outdated
Comment thread Tools/i18n/pygettext.py Outdated
@StanFromIreland
StanFromIreland requested a review from tomasr8 March 9, 2025 22:11

@tomasr8 tomasr8 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@StanFromIreland

Copy link
Copy Markdown
Member Author

Little reminder @serhiy-storchaka

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use non-ASCII strings and non-UTF-8 source encoding for tests. The encoding should also be different from Latin1. Maybe iso-8859-15 with in a string. Use both literal and \u20ac (in different strings, so the error will be easier to identify).

Comment thread Tools/i18n/pygettext.py Outdated
@StanFromIreland

Copy link
Copy Markdown
Member Author

Please use non-ASCII strings and non-UTF-8 source encoding for tests.

Might I ask why? The implementation does effect anything beyond the header, it is literally a single if statement. The file is generated so we can verify whitespace, at Tomas's request.

@serhiy-storchaka

Copy link
Copy Markdown
Member

Why to add this feature at first place? If it is for tests, we should ensure that it works with non-ASCII strings. Otherwise this option will be useless.

We need also tests with non-ASCII strings for gettext and pygettext, but this is a different issue.

@StanFromIreland

Copy link
Copy Markdown
Member Author

Why to add this feature at first place?

See the linked issue, this was discussed before.

we should ensure that it works with non-ASCII strings.

This feature just removes the POT header.

@StanFromIreland

Copy link
Copy Markdown
Member Author

Friendly ping @serhiy-storchaka :-)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with this feature is that we are losing information about the .po file encoding, which is locale depending. Therefore, files generated on different computers may be incompatible. There is an issue with using the default file encoding in general, because it may be not compatible with the source file encoding (msgids and comments) and filesystem encoding (file names).

We can probably just ignore this for now. And then somehow solve all the encoding problems at once.

But adding a feature that contains an inherent flaw leaves a bitter aftertaste.

@StanFromIreland

This comment was marked as duplicate.

@StanFromIreland

Copy link
Copy Markdown
Member Author

Friendly ping @serhiy-storchaka / @tomasr8

@StanFromIreland

Copy link
Copy Markdown
Member Author

@serhiy-storchaka, anything else I should do here?

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 22, 2026
@serhiy-storchaka

Copy link
Copy Markdown
Member

@StanFromIreland, you can merge this PR yourself.

@StanFromIreland
StanFromIreland merged commit e8158d1 into python:main Aug 20, 2026
51 checks passed
@StanFromIreland
StanFromIreland deleted the omit-header branch August 20, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants