bpo-10536: Enhancements to gettext docs#10324
Conversation
Port of a patch for 2.x to master Co-authored-by: Éric Araujo <merwok@netwok.org>
Doc/library/gettext.rst
Outdated
| fp.close() | ||
| with open(filename, 'w') as fp: | ||
| fp.write(message) | ||
| fp.close() |
There was a problem hiding this comment.
yep, sure, I have updated the branch with your patch and when there was an issue, I have just changed the content. +1
Doc/library/gettext.rst
Outdated
| 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.prefix/share/locale`. For this | ||
| defaults; instead its default is :file:`{sys.prefix}/share/locale`. For this |
There was a problem hiding this comment.
I wonder if it would be useful to rework that line to add a linked reference to sys.prefix.
Maybe adding (see :data:`sys.prefix`) at the end of the sentence?
There was a problem hiding this comment.
why not, can be useful.
Doc/library/gettext.rst
Outdated
| defaults; instead its default is :file:`{sys.prefix}/share/locale`. For this | ||
| reason, it is always best to call :func:`bindtextdomain` with an explicit | ||
| absolute path at the start of your application. | ||
| absolute path at the start of your application (see :data:`sys.prefix`). |
There was a problem hiding this comment.
Ah I meant two lines before:
its default is :file:`{sys.prefix}/share/locale` (see :data:`sys.prefix`)
|
@merwok an other point in your review? |
|
Thanks both of your for this nice enhancement 👍 |
|
You're welcome |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
And perhaps replace :file:`<language-name>.po` with :file:`{language-name}.po`?
| files, and has methods for returning strings. Instances of this "translations" | ||
| class can also install themselves in the built-in namespace as the function | ||
| :func:`_`. | ||
| a :class:`GNUTranslations` class which implements the parsing of GNU :file:`.mo` format |
There was a problem hiding this comment.
Wouldn't be better to keep a "translations"? GNUTranslations is just a concrete implementation of a "translations" class.
Otherwise perhaps it should be the.
| This function implements the standard :file:`.mo` file search algorithm. It | ||
| takes a *domain*, identical to what :func:`textdomain` takes. Optional | ||
| *localedir* is as in :func:`bindtextdomain` Optional *languages* is a list of | ||
| *localedir* is as in :func:`bindtextdomain`. Optional *languages* is a list of |
There was a problem hiding this comment.
A dot was missed, but it would be better to keep a double space after it.
| in both big-endian and little-endian format. | ||
|
|
||
| :class:`GNUTranslations` parses optional meta-data out of the translation | ||
| catalog. It is convention with GNU :program:`gettext` to include meta-data as |
There was a problem hiding this comment.
Double space after sentence ending period is not an error. It increases readability.
| 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 encoding is assumed. |
There was a problem hiding this comment.
Is it incorrect? "ASCII encoding", "UTF-8 encoding", "Windows-1252 encoding" etc are used in other places in docs.
|
Thanks @matrixise for the PR, and @JulienPalard for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
(cherry picked from commit 55f3317) Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
|
GH-13224 is a backport of this pull request to the 3.7 branch. |
(cherry picked from commit 55f3317) Co-authored-by: Stéphane Wirtel <stephane@wirtel.be> https://bugs.python.org/issue10536
Port of a patch for 2.x to master
Co-authored-by: Éric Araujo merwok@netwok.org
https://bugs.python.org/issue10536