From 181758b7e5d1664084c500b3f934cd475d8345d6 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 3 Dec 2023 19:48:38 +0200 Subject: [PATCH 1/3] Fix Sphinx warning in library/gettext.rst --- Doc/library/gettext.rst | 10 +++++----- Doc/tools/.nitignore | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Doc/library/gettext.rst b/Doc/library/gettext.rst index dc6cf5533fccbe..457c20dd9859fe 100644 --- a/Doc/library/gettext.rst +++ b/Doc/library/gettext.rst @@ -257,7 +257,7 @@ are the methods of :class:`!NullTranslations`: .. method:: info() - Return the "protected" :attr:`_info` variable, a dictionary containing + Return the "protected" :attr:`!_info` variable, a dictionary containing the metadata found in the message catalog file. @@ -298,7 +298,7 @@ The :class:`GNUTranslations` class The :mod:`gettext` module provides one additional class derived from :class:`NullTranslations`: :class:`GNUTranslations`. This class overrides -:meth:`_parse` to enable reading GNU :program:`gettext` format :file:`.mo` files +:meth:`!_parse` to enable reading GNU :program:`gettext` format :file:`.mo` files in both big-endian and little-endian format. :class:`GNUTranslations` parses optional metadata out of the translation @@ -306,7 +306,7 @@ catalog. It is convention with GNU :program:`gettext` to include metadata as the translation for the empty string. This metadata is in :rfc:`822`\ -style ``key: value`` pairs, and should contain the ``Project-Id-Version`` key. If the key ``Content-Type`` is found, then the ``charset`` property is used to -initialize the "protected" :attr:`_charset` instance variable, defaulting to +initialize the "protected" :attr:`!_charset` instance variable, defaulting to ``None`` if not found. If the charset encoding is specified, then all message ids and message strings read from the catalog are converted to Unicode using this encoding, else ASCII is assumed. @@ -315,7 +315,7 @@ Since message ids are read as Unicode strings too, all ``*gettext()`` methods will assume message ids as Unicode strings, not byte strings. The entire set of key/value pairs are placed into a dictionary and set as the -"protected" :attr:`_info` instance variable. +"protected" :attr:`!_info` instance variable. If the :file:`.mo` file's magic number is invalid, the major version number is unexpected, or if other problems occur while reading the file, instantiating a @@ -636,7 +636,7 @@ implementations, and valuable experience to the creation of this module: .. rubric:: Footnotes -.. [#] The default locale directory is system dependent; for example, on RedHat Linux +.. [#] The default locale directory is system dependent; for example, on Red Hat Linux it is :file:`/usr/share/locale`, but on Solaris it is :file:`/usr/lib/locale`. The :mod:`gettext` module does not try to support these system dependent defaults; instead its default is :file:`{sys.base_prefix}/share/locale` (see diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore index 1e3e367460147a..8d79a848b7cc7b 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -58,7 +58,6 @@ Doc/library/fcntl.rst Doc/library/ftplib.rst Doc/library/functions.rst Doc/library/functools.rst -Doc/library/gettext.rst Doc/library/http.client.rst Doc/library/http.cookiejar.rst Doc/library/http.cookies.rst From 1187d0835b06c23de3bd1dab3590e1b14767b53c Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 3 Dec 2023 20:14:27 +0200 Subject: [PATCH 2/3] Don't unnecessarily mention internals Co-authored-by: Alex Waygood --- Doc/library/gettext.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/gettext.rst b/Doc/library/gettext.rst index 457c20dd9859fe..13ec70349973e7 100644 --- a/Doc/library/gettext.rst +++ b/Doc/library/gettext.rst @@ -257,7 +257,7 @@ are the methods of :class:`!NullTranslations`: .. method:: info() - Return the "protected" :attr:`!_info` variable, a dictionary containing + Return a dictionary containing the metadata found in the message catalog file. From 168111e6d35fb75a7ea8935e4fdd9fbd20430284 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sun, 3 Dec 2023 13:15:42 -0700 Subject: [PATCH 3/3] No need to link to the module we're already in Co-authored-by: Alex Waygood --- Doc/library/gettext.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/gettext.rst b/Doc/library/gettext.rst index 13ec70349973e7..41beac3e0c7396 100644 --- a/Doc/library/gettext.rst +++ b/Doc/library/gettext.rst @@ -296,7 +296,7 @@ are the methods of :class:`!NullTranslations`: The :class:`GNUTranslations` class ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The :mod:`gettext` module provides one additional class derived from +The :mod:`!gettext` module provides one additional class derived from :class:`NullTranslations`: :class:`GNUTranslations`. This class overrides :meth:`!_parse` to enable reading GNU :program:`gettext` format :file:`.mo` files in both big-endian and little-endian format. @@ -638,7 +638,7 @@ implementations, and valuable experience to the creation of this module: .. [#] The default locale directory is system dependent; for example, on Red Hat Linux it is :file:`/usr/share/locale`, but on Solaris it is :file:`/usr/lib/locale`. - The :mod:`gettext` module does not try to support these system dependent + The :mod:`!gettext` module does not try to support these system dependent defaults; instead its default is :file:`{sys.base_prefix}/share/locale` (see :data:`sys.base_prefix`). For this reason, it is always best to call :func:`bindtextdomain` with an explicit absolute path at the start of your