-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-130453: pygettext: Allow specifying multiple keywords with the same function name #131380
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
serhiy-storchaka
merged 13 commits into
python:main
from
tomasr8:pygettext-mult-keywords
Apr 10, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
67c5cf7
Allow passing multiple keywords with the same funcname.
tomasr8 63516d1
Add news entry
tomasr8 4426daf
Simplify code
tomasr8 9f8e9b1
Do not print error messages if atleast 1 spec matches
tomasr8 ec02b07
Add unparse_spec
tomasr8 4aa5151
Print errors in a more structured way
tomasr8 2dcab79
Improve keyword merging
tomasr8 a354d19
Update Tools/i18n/pygettext.py
tomasr8 ab02d21
Windows fix
tomasr8 bac8b8d
PEP8
tomasr8 a3d5d56
Merge branch 'main' into pygettext-mult-keywords
serhiy-storchaka 51b48f0
Fix typo
tomasr8 4daad1b
Simplify keyword parsing
tomasr8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# SOME DESCRIPTIVE TITLE. | ||
# Copyright (C) YEAR ORGANIZATION | ||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: PACKAGE VERSION\n" | ||
"POT-Creation-Date: 2000-01-01 00:00+0000\n" | ||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: LANGUAGE <LL@li.org>\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: pygettext.py 1.5\n" | ||
|
||
|
||
#: multiple_keywords.py:3 | ||
msgid "bar" | ||
msgstr "" | ||
|
||
#: multiple_keywords.py:5 | ||
msgctxt "baz" | ||
msgid "qux" | ||
msgstr "" | ||
|
||
#: multiple_keywords.py:9 | ||
msgctxt "corge" | ||
msgid "grault" | ||
msgstr "" | ||
|
||
#: multiple_keywords.py:11 | ||
msgctxt "xyzzy" | ||
msgid "foo" | ||
msgid_plural "foos" | ||
msgstr[0] "" | ||
msgstr[1] "" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from gettext import gettext as foo | ||
|
||
foo('bar') | ||
|
||
foo('baz', 'qux') | ||
|
||
# The 't' specifier is not supported, so the following | ||
# call is extracted as pgettext instead of ngettext. | ||
foo('corge', 'grault', 1) | ||
|
||
foo('xyzzy', 'foo', 'foos', 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Tools-Demos/2025-03-10-08-19-22.gh-issue-130453.9B0x8k.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Allow passing multiple keyword arguments with the same function name in | ||
:program:`pygettext`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.