mirror of https://github.com/python/cpython
bpo-31667: Fix gettext related links. (#3860)
* Fix incorrect links. * Remove redundant links. * Add signatures and index entries for gettext related functions in the locale module.
This commit is contained in:
parent
77732be801
commit
c02a1f4ad8
|
@ -134,7 +134,7 @@ Class-based API
|
||||||
|
|
||||||
The class-based API of the :mod:`gettext` module gives you more flexibility and
|
The class-based API of the :mod:`gettext` module gives you more flexibility and
|
||||||
greater convenience than the GNU :program:`gettext` API. It is the recommended
|
greater convenience than the GNU :program:`gettext` API. It is the recommended
|
||||||
way of localizing your Python applications and modules. :mod:`gettext` defines
|
way of localizing your Python applications and modules. :mod:`!gettext` defines
|
||||||
a "translations" class which implements the parsing of GNU :file:`.mo` format
|
a "translations" class which implements the parsing of GNU :file:`.mo` format
|
||||||
files, and has methods for returning strings. Instances of this "translations"
|
files, and has methods for returning strings. Instances of this "translations"
|
||||||
class can also install themselves in the built-in namespace as the function
|
class can also install themselves in the built-in namespace as the function
|
||||||
|
@ -219,7 +219,7 @@ Translation classes are what actually implement the translation of original
|
||||||
source file message strings to translated message strings. The base class used
|
source file message strings to translated message strings. The base class used
|
||||||
by all translation classes is :class:`NullTranslations`; this provides the basic
|
by all translation classes is :class:`NullTranslations`; this provides the basic
|
||||||
interface you can use to write your own specialized translation classes. Here
|
interface you can use to write your own specialized translation classes. Here
|
||||||
are the methods of :class:`NullTranslations`:
|
are the methods of :class:`!NullTranslations`:
|
||||||
|
|
||||||
|
|
||||||
.. class:: NullTranslations(fp=None)
|
.. class:: NullTranslations(fp=None)
|
||||||
|
@ -247,13 +247,13 @@ are the methods of :class:`NullTranslations`:
|
||||||
|
|
||||||
.. method:: gettext(message)
|
.. method:: gettext(message)
|
||||||
|
|
||||||
If a fallback has been set, forward :meth:`.gettext` to the fallback.
|
If a fallback has been set, forward :meth:`!gettext` to the fallback.
|
||||||
Otherwise, return *message*. Overridden in derived classes.
|
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.
|
If a fallback has been set, forward :meth:`!ngettext` to the fallback.
|
||||||
Otherwise, return *singular* if *n* is 1; return *plural* otherwise.
|
Otherwise, return *singular* if *n* is 1; return *plural* otherwise.
|
||||||
Overridden in derived classes.
|
Overridden in derived classes.
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ are the methods of :class:`NullTranslations`:
|
||||||
.. method:: lgettext(message)
|
.. method:: lgettext(message)
|
||||||
.. method:: lngettext(singular, plural, n)
|
.. method:: lngettext(singular, plural, n)
|
||||||
|
|
||||||
Equivalent to :meth:`.gettext` and :meth:`ngettext`, but the translation
|
Equivalent to :meth:`.gettext` and :meth:`.ngettext`, but the translation
|
||||||
is returned as a byte string encoded in the preferred system encoding
|
is returned as a byte string encoded in the preferred system encoding
|
||||||
if no encoding was explicitly set with :meth:`set_output_charset`.
|
if no encoding was explicitly set with :meth:`set_output_charset`.
|
||||||
Overridden in derived classes.
|
Overridden in derived classes.
|
||||||
|
|
|
@ -551,17 +551,23 @@ library.
|
||||||
Access to message catalogs
|
Access to message catalogs
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
|
.. function:: gettext(msg)
|
||||||
|
.. function:: dgettext(domain, msg)
|
||||||
|
.. function:: dcgettext(domain, msg, category)
|
||||||
|
.. function:: textdomain(domain)
|
||||||
|
.. function:: bindtextdomain(domain, dir)
|
||||||
|
|
||||||
The locale module exposes the C library's gettext interface on systems that
|
The locale module exposes the C library's gettext interface on systems that
|
||||||
provide this interface. It consists of the functions :func:`gettext`,
|
provide this interface. It consists of the functions :func:`!gettext`,
|
||||||
:func:`dgettext`, :func:`dcgettext`, :func:`textdomain`, :func:`bindtextdomain`,
|
:func:`!dgettext`, :func:`!dcgettext`, :func:`!textdomain`, :func:`!bindtextdomain`,
|
||||||
and :func:`bind_textdomain_codeset`. These are similar to the same functions in
|
and :func:`!bind_textdomain_codeset`. These are similar to the same functions in
|
||||||
the :mod:`gettext` module, but use the C library's binary format for message
|
the :mod:`gettext` module, but use the C library's binary format for message
|
||||||
catalogs, and the C library's search algorithms for locating message catalogs.
|
catalogs, and the C library's search algorithms for locating message catalogs.
|
||||||
|
|
||||||
Python applications should normally find no need to invoke these functions, and
|
Python applications should normally find no need to invoke these functions, and
|
||||||
should use :mod:`gettext` instead. A known exception to this rule are
|
should use :mod:`gettext` instead. A known exception to this rule are
|
||||||
applications that link with additional C libraries which internally invoke
|
applications that link with additional C libraries which internally invoke
|
||||||
:c:func:`gettext` or :func:`dcgettext`. For these applications, it may be
|
:c:func:`gettext` or :c:func:`dcgettext`. For these applications, it may be
|
||||||
necessary to bind the text domain, so that the libraries can properly locate
|
necessary to bind the text domain, so that the libraries can properly locate
|
||||||
their message catalogs.
|
their message catalogs.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue