@@ -58,7 +58,7 @@ class-based API instead.
5858
5959   Return the localized translation of *message *, based on the current global
6060   domain, language, and locale directory.  This function is usually aliased as
61-    :func: `_ ` in the local namespace (see examples below).
61+    :func: `! _ ` in the local namespace (see examples below).
6262
6363
6464.. function :: dgettext(domain, message) 
@@ -98,7 +98,7 @@ class-based API instead.
9898   .. versionadded :: 3.8 
9999
100100
101- Note that GNU :program: `gettext ` also defines a :func: `dcgettext ` method, but
101+ Note that GNU :program: `gettext ` also defines a :func: `! dcgettext ` method, but
102102this was deemed not useful and so it is currently unimplemented.
103103
104104Here's an example of typical usage for this API::
@@ -119,7 +119,7 @@ greater convenience than the GNU :program:`gettext` API.  It is the recommended
119119way of localizing your Python applications and modules.  :mod: `!gettext ` defines
120120a :class: `GNUTranslations ` class which implements the parsing of GNU :file: `.mo ` format
121121files, and has methods for returning strings. Instances of this class can also
122- install themselves in the built-in namespace as the function :func: `_ `.
122+ install themselves in the built-in namespace as the function :func: `! _ `.
123123
124124
125125.. function :: find(domain, localedir=None, languages=None, all=False) 
@@ -150,15 +150,12 @@ install themselves in the built-in namespace as the function :func:`_`.
150150
151151.. function :: translation(domain, localedir=None, languages=None, class_=None, fallback=False) 
152152
153-    Return a :class: ` *Translations ` instance based on the *domain *, *localedir *,
153+    Return a `` *Translations ` ` instance based on the *domain *, *localedir *,
154154   and *languages *, which are first passed to :func: `find ` to get a list of the
155155   associated :file: `.mo ` file paths.  Instances with identical :file: `.mo ` file
156156   names are cached.  The actual class instantiated is *class_ * if
157157   provided, otherwise :class: `GNUTranslations `.  The class's constructor must
158-    take a single :term: `file object ` argument.  If provided, *codeset * will change
159-    the charset used to encode translated strings in the
160-    :meth: `~NullTranslations.lgettext ` and :meth: `~NullTranslations.lngettext `
161-    methods.
158+    take a single :term: `file object ` argument.
162159
163160   If multiple files are found, later files are used as fallbacks for earlier ones.
164161   To allow setting the fallback, :func: `copy.copy ` is used to clone each
@@ -177,19 +174,19 @@ install themselves in the built-in namespace as the function :func:`_`.
177174
178175.. function :: install(domain, localedir=None, *, names=None) 
179176
180-    This installs the function :func: `_ ` in Python's builtins namespace, based on
177+    This installs the function :func: `! _ ` in Python's builtins namespace, based on
181178   *domain * and *localedir * which are passed to the function :func: `translation `.
182179
183180   For the *names * parameter, please see the description of the translation
184181   object's :meth: `~NullTranslations.install ` method.
185182
186183   As seen below, you usually mark the strings in your application that are
187-    candidates for translation, by wrapping them in a call to the :func: `_ `
184+    candidates for translation, by wrapping them in a call to the :func: `! _ `
188185   function, like this::
189186
190187      print(_('This string will be translated.')) 
191188
192-    For convenience, you want the :func: `_ ` function to be installed in Python's
189+    For convenience, you want the :func: `! _ ` function to be installed in Python's
193190   builtins namespace, so it is easily accessible in all modules of your
194191   application.
195192
@@ -276,20 +273,20 @@ are the methods of :class:`!NullTranslations`:
276273
277274      If the *names * parameter is given, it must be a sequence containing the
278275      names of functions you want to install in the builtins namespace in
279-       addition to :func: `_ `.  Supported names are ``'gettext' ``, ``'ngettext' ``,
280-       ``'pgettext' ``, `` 'npgettext' ``, `` 'lgettext' ``,  and ``'lngettext ' ``.
276+       addition to :func: `! _ `.  Supported names are ``'gettext' ``, ``'ngettext' ``,
277+       ``'pgettext' ``, and ``'npgettext ' ``.
281278
282279      Note that this is only one way, albeit the most convenient way, to make
283-       the :func: `_ ` function available to your application.  Because it affects
280+       the :func: `! _ ` function available to your application.  Because it affects
284281      the entire application globally, and specifically the built-in namespace,
285-       localized modules should never install :func: `_ `. Instead, they should use
286-       this code to make :func: `_ ` available to their module::
282+       localized modules should never install :func: `! _ `. Instead, they should use
283+       this code to make :func: `! _ ` available to their module::
287284
288285         import gettext 
289286         t = gettext.translation('mymodule', ...) 
290287         _ = t.gettext 
291288
292-       This puts :func: `_ ` only in the module's global namespace and so only
289+       This puts :func: `! _ ` only in the module's global namespace and so only
293290      affects calls within this module.
294291
295292      .. versionchanged :: 3.8 
@@ -314,7 +311,7 @@ initialize the "protected" :attr:`_charset` instance variable, defaulting to
314311ids and message strings read from the catalog are converted to Unicode using
315312this encoding, else ASCII is assumed.
316313
317- Since message ids are read as Unicode strings too, all :meth: ` *gettext ` methods
314+ Since message ids are read as Unicode strings too, all `` *gettext()  ` ` methods
318315will assume message ids as Unicode strings, not byte strings.
319316
320317The entire set of key/value pairs are placed into a dictionary and set as the
@@ -404,7 +401,7 @@ version has a slightly different API.  Its documented usage was::
404401   _ = cat.gettext 
405402   print(_('hello world')) 
406403
407- For compatibility with this older module, the function :func: `Catalog ` is an
404+ For compatibility with this older module, the function :func: `! Catalog ` is an
408405alias for the :func: `translation ` function described above.
409406
410407One difference between this module and Henstridge's: his catalog objects
@@ -432,7 +429,7 @@ take the following steps:
432429
433430In order to prepare your code for I18N, you need to look at all the strings in
434431your files.  Any string that needs to be translated should be marked by wrapping
435- it in ``_('...') `` --- that is, a call to the function :func: `_ `.  For example::
432+ it in ``_('...') `` --- that is, a call to the function :func: `_ <gettext>  `.  For example::
436433
437434   filename = 'mylog.txt' 
438435   message = _('writing a log message') 
@@ -504,7 +501,7 @@ module::
504501Localizing your application
505502^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
506503
507- If you are localizing your application, you can install the :func: `_ ` function
504+ If you are localizing your application, you can install the :func: `! _ ` function
508505globally into the built-in namespace, usually in the main driver file of your
509506application.  This will let all your application-specific files just use
510507``_('...') `` without having to explicitly install it in each file.
@@ -581,13 +578,13 @@ Here is one way you can handle this situation::
581578   for a in animals: 
582579       print(_(a)) 
583580
584- This works because the dummy definition of :func: `_ ` simply returns the string
581+ This works because the dummy definition of :func: `! _ ` simply returns the string
585582unchanged.  And this dummy definition will temporarily override any definition
586- of :func: `_ ` in the built-in namespace (until the :keyword: `del ` command). Take
587- care, though if you have a previous definition of :func: `_ ` in the local
583+ of :func: `! _ ` in the built-in namespace (until the :keyword: `del ` command). Take
584+ care, though if you have a previous definition of :func: `! _ ` in the local
588585namespace.
589586
590- Note that the second use of :func: `_ ` will not identify "a" as being
587+ Note that the second use of :func: `! _ ` will not identify "a" as being
591588translatable to the :program: `gettext ` program, because the parameter
592589is not a string literal.
593590
@@ -606,13 +603,13 @@ Another way to handle this is with the following example::
606603       print(_(a)) 
607604
608605In this case, you are marking translatable strings with the function
609- :func: `N_ `, which won't conflict with any definition of :func: `_ `.
606+ :func: `! N_ `, which won't conflict with any definition of :func: `! _ `.
610607However, you will need to teach your message extraction program to
611- look for translatable strings marked with :func: `N_ `. :program: `xgettext `,
608+ look for translatable strings marked with :func: `! N_ `. :program: `xgettext `,
612609:program: `pygettext `, ``pybabel extract ``, and :program: `xpot ` all
613610support this through the use of the :option: `!-k ` command-line switch.
614- The choice of :func: `N_ ` here is totally arbitrary; it could have just
615- as easily been :func: `MarkThisStringForTranslation `.
611+ The choice of :func: `! N_ ` here is totally arbitrary; it could have just
612+ as easily been :func: `! MarkThisStringForTranslation `.
616613
617614
618615Acknowledgements
0 commit comments