diff options
-rw-r--r-- | Lib/test/test_tools/test_i18n.py | 6 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Tools-Demos/2025-02-09-20-29-06.gh-issue-129911.uMFtf1.rst | 1 | ||||
-rwxr-xr-x | Tools/i18n/pygettext.py | 5 |
3 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_tools/test_i18n.py b/Lib/test/test_tools/test_i18n.py index d23479104d4..f5aba31ed42 100644 --- a/Lib/test/test_tools/test_i18n.py +++ b/Lib/test/test_tools/test_i18n.py @@ -413,6 +413,12 @@ class Test_pygettext(unittest.TestCase): self.assertIn(f'msgid "{text2}"', data) self.assertNotIn(text3, data) + def test_help_text(self): + """Test that the help text is displayed.""" + res = assert_python_ok(self.script, '--help') + self.assertEqual(res.out, b'') + self.assertIn(b'pygettext -- Python equivalent of xgettext(1)', res.err) + def test_error_messages(self): """Test that pygettext outputs error messages to stderr.""" stderr = self.get_stderr(dedent('''\ diff --git a/Misc/NEWS.d/next/Tools-Demos/2025-02-09-20-29-06.gh-issue-129911.uMFtf1.rst b/Misc/NEWS.d/next/Tools-Demos/2025-02-09-20-29-06.gh-issue-129911.uMFtf1.rst new file mode 100644 index 00000000000..1903af78128 --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/2025-02-09-20-29-06.gh-issue-129911.uMFtf1.rst @@ -0,0 +1 @@ +Fix the keyword entry in the help output of :program:`pygettext`. diff --git a/Tools/i18n/pygettext.py b/Tools/i18n/pygettext.py index 4720aecbdc5..4177d46048f 100755 --- a/Tools/i18n/pygettext.py +++ b/Tools/i18n/pygettext.py @@ -67,7 +67,8 @@ Options: -k word --keyword=word Keywords to look for in addition to the default set, which are: - %(DEFAULTKEYWORDS)s + _, gettext, ngettext, pgettext, npgettext, dgettext, dngettext, + dpgettext, and dnpgettext. You can have multiple -k flags on the command line. @@ -169,7 +170,7 @@ msgstr "" def usage(code, msg=''): - print(__doc__ % globals(), file=sys.stderr) + print(__doc__, file=sys.stderr) if msg: print(msg, file=sys.stderr) sys.exit(code) |