KEMBAR78
gh-130453: pygettext: Allow overriding default keywords when using `--keyword` by tomasr8 · Pull Request #130709 · python/cpython · GitHub
Skip to content

Conversation

@tomasr8
Copy link
Member

@tomasr8 tomasr8 commented Feb 28, 2025

Related comment: #130453 (comment)

Both babel and xgettext allow this. For example for xgettext --keyword='_:1,2' and this input file

_('foo', 'foos', 1)

xgettext will extract

msgid "foo"
msgid_plural "foos"
msgstr[0] ""
msgstr[1] ""

while pygettext will extract

msgid "foo"
msgstr ""

i.e. the default keyword takes precedence. It should be possible to use --keyword to override the default keyword (_:1) same as xgettext and babel.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. 👍

@serhiy-storchaka serhiy-storchaka merged commit 321bf59 into python:main Mar 3, 2025
45 checks passed
@tomasr8 tomasr8 deleted the pygettext-precedence branch March 3, 2025 20:10
seehwan pushed a commit to seehwan/cpython that referenced this pull request Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants