https://github.com/python/cpython/commit/1837c17bc78b8169cd6c1c5799dcf6a71c3eac83
commit: 1837c17bc78b8169cd6c1c5799dcf6a71c3eac83
branch: main
author: Stan Ulbrych <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-05-31T09:08:17+01:00
summary:
gh-140553: Mark `*gettext` parameters as positionaly only in documentation
(#140598)
files:
M Doc/library/gettext.rst
diff --git a/Doc/library/gettext.rst b/Doc/library/gettext.rst
index 2de16fe40362b3..2ab7ba7df19cf1 100644
--- a/Doc/library/gettext.rst
+++ b/Doc/library/gettext.rst
@@ -51,19 +51,19 @@ class-based API instead.
.. index:: single: _ (underscore); gettext
-.. function:: gettext(message)
+.. function:: gettext(message, /)
Return the localized translation of *message*, based on the current global
domain, language, and locale directory. This function is usually aliased as
:func:`!_` in the local namespace (see examples below).
-.. function:: dgettext(domain, message)
+.. function:: dgettext(domain, message, /)
Like :func:`.gettext`, but look the message up in the specified *domain*.
-.. function:: ngettext(singular, plural, n)
+.. function:: ngettext(singular, plural, n, /)
Like :func:`.gettext`, but consider plural forms. If a translation is found,
apply the plural formula to *n*, and return the resulting message (some
@@ -78,15 +78,15 @@ class-based API instead.
formulas for a variety of languages.
-.. function:: dngettext(domain, singular, plural, n)
+.. function:: dngettext(domain, singular, plural, n, /)
Like :func:`ngettext`, but look the message up in the specified *domain*.
-.. function:: pgettext(context, message)
-.. function:: dpgettext(domain, context, message)
-.. function:: npgettext(context, singular, plural, n)
-.. function:: dnpgettext(domain, context, singular, plural, n)
+.. function:: pgettext(context, message, /)
+.. function:: dpgettext(domain, context, message, /)
+.. function:: npgettext(context, singular, plural, n, /)
+.. function:: dnpgettext(domain, context, singular, plural, n, /)
Similar to the corresponding functions without the ``p`` in the prefix (that
is, :func:`gettext`, :func:`dgettext`, :func:`ngettext`, :func:`dngettext`),
@@ -223,20 +223,20 @@ are the methods of :class:`!NullTranslations`:
translation for a given message.
- .. method:: gettext(message)
+ .. method:: gettext(message, /)
If a fallback has been set, forward :meth:`!gettext` to the fallback.
Otherwise, return *message*. Overridden in derived classes.
- .. method:: ngettext(singular, plural, n)
+ .. method:: ngettext(singular, plural, n, /)
If a fallback has been set, forward :meth:`!ngettext` to the fallback.
Otherwise, return *singular* if *n* is 1; return *plural* otherwise.
Overridden in derived classes.
- .. method:: pgettext(context, message)
+ .. method:: pgettext(context, message, /)
If a fallback has been set, forward :meth:`pgettext` to the fallback.
Otherwise, return the translated message. Overridden in derived classes.
@@ -244,7 +244,7 @@ are the methods of :class:`!NullTranslations`:
.. versionadded:: 3.8
- .. method:: npgettext(context, singular, plural, n)
+ .. method:: npgettext(context, singular, plural, n, /)
If a fallback has been set, forward :meth:`npgettext` to the fallback.
Otherwise, return the translated message. Overridden in derived classes.
@@ -322,7 +322,7 @@ unexpected, or if other problems occur while reading the
file, instantiating a
The following methods are overridden from the base class implementation:
- .. method:: gettext(message)
+ .. method:: gettext(message, /)
Look up the *message* id in the catalog and return the corresponding
message
string, as a Unicode string. If there is no entry in the catalog for the
@@ -331,7 +331,7 @@ unexpected, or if other problems occur while reading the
file, instantiating a
*message* id is returned.
- .. method:: ngettext(singular, plural, n)
+ .. method:: ngettext(singular, plural, n, /)
Do a plural-forms lookup of a message id. *singular* is used as the
message id
for purposes of lookup in the catalog, while *n* is used to determine
which
@@ -352,7 +352,7 @@ unexpected, or if other problems occur while reading the
file, instantiating a
n) % {'num': n}
- .. method:: pgettext(context, message)
+ .. method:: pgettext(context, message, /)
Look up the *context* and *message* id in the catalog and return the
corresponding message string, as a Unicode string. If there is no
@@ -363,7 +363,7 @@ unexpected, or if other problems occur while reading the
file, instantiating a
.. versionadded:: 3.8
- .. method:: npgettext(context, singular, plural, n)
+ .. method:: npgettext(context, singular, plural, n, /)
Do a plural-forms lookup of a message id. *singular* is used as the
message id for purposes of lookup in the catalog, while *n* is used to
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]