Skip to content

Commit 9d1e668

Browse files
authored
gh-129911: pygettext: Fix the keyword entry in help output (GH-129914)
1 parent 3bd3e09 commit 9d1e668

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Lib/test/test_tools/test_i18n.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,12 @@ def test_files_list(self):
413413
self.assertIn(f'msgid "{text2}"', data)
414414
self.assertNotIn(text3, data)
415415

416+
def test_help_text(self):
417+
"""Test that the help text is displayed."""
418+
res = assert_python_ok(self.script, '--help')
419+
self.assertEqual(res.out, b'')
420+
self.assertIn(b'pygettext -- Python equivalent of xgettext(1)', res.err)
421+
416422
def test_error_messages(self):
417423
"""Test that pygettext outputs error messages to stderr."""
418424
stderr = self.get_stderr(dedent('''\
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix the keyword entry in the help output of :program:`pygettext`.

Tools/i18n/pygettext.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
-k word
6868
--keyword=word
6969
Keywords to look for in addition to the default set, which are:
70-
%(DEFAULTKEYWORDS)s
70+
_, gettext, ngettext, pgettext, npgettext, dgettext, dngettext,
71+
dpgettext, and dnpgettext.
7172
7273
You can have multiple -k flags on the command line.
7374
@@ -169,7 +170,7 @@
169170

170171

171172
def usage(code, msg=''):
172-
print(__doc__ % globals(), file=sys.stderr)
173+
print(__doc__, file=sys.stderr)
173174
if msg:
174175
print(msg, file=sys.stderr)
175176
sys.exit(code)

0 commit comments

Comments
 (0)