• Home
  • Raw
  • Download

Lines Matching full:gettext

1 :mod:`gettext` --- Multilingual internationalization services
4 .. module:: gettext
10 **Source code:** :source:`Lib/gettext.py`
14 The :mod:`gettext` module provides internationalization (I18N) and localization
16 GNU :program:`gettext` message catalog API and a higher level, class-based API that may
25 GNU :program:`gettext` API
28 The :mod:`gettext` module defines the following API, which is very similar to
29 the GNU :program:`gettext` API. If you use this API you will affect the
40 :mod:`gettext` will look for binary :file:`.mo` files for the given domain using
56 .. index:: single: _ (underscore); gettext
57 .. function:: gettext(message)
66 Like :func:`.gettext`, but look the message up in the specified *domain*.
71 Like :func:`.gettext`, but consider plural forms. If a translation is found,
79 `the GNU gettext documentation <https://www.gnu.org/software/gettext/manual/gettext.html>`__
95 is, :func:`gettext`, :func:`dgettext`, :func:`ngettext`, :func:`dngettext`),
101 Note that GNU :program:`gettext` also defines a :func:`dcgettext` method, but
106 import gettext
107 gettext.bindtextdomain('myapplication', '/path/to/my/language/directory')
108 gettext.textdomain('myapplication')
109 _ = gettext.gettext
117 The class-based API of the :mod:`gettext` module gives you more flexibility and
118 greater convenience than the GNU :program:`gettext` API. It is the recommended
119 way of localizing your Python applications and modules. :mod:`!gettext` defines
232 .. method:: gettext(message)
234 If a fallback has been set, forward :meth:`!gettext` to the fallback.
274 This method installs :meth:`.gettext` into the built-in namespace,
279 addition to :func:`_`. Supported names are ``'gettext'``, ``'ngettext'``,
288 import gettext
289 t = gettext.translation('mymodule', ...)
290 _ = t.gettext
302 The :mod:`gettext` module provides one additional class derived from
304 :meth:`_parse` to enable reading GNU :program:`gettext` format :file:`.mo` files
308 catalog. It is convention with GNU :program:`gettext` to include metadata as
317 Since message ids are read as Unicode strings too, all :meth:`*gettext` methods
331 .. method:: gettext(message)
336 fallback's :meth:`~NullTranslations.gettext` method. Otherwise, the
399 GNOME uses a version of the :mod:`gettext` module by James Henstridge, but this
402 import gettext
403 cat = gettext.Catalog(domain, localedir)
404 _ = cat.gettext
430 #. use the :mod:`gettext` module so that message strings are properly translated
445 The original GNU :program:`gettext` only supported C or C++ source
463 :program:`gettext` package to internationalize your Python
478 :mod:`gettext` module for the actual translation processing at
481 How you use the :mod:`gettext` module in your code depends on whether you are
490 changes, e.g. to the built-in namespace. You should not use the GNU :program:`gettext`
495 :program:`gettext` format. Here's what you would put at the top of your
498 import gettext
499 t = gettext.translation('spam', '/usr/share/locale')
500 _ = t.gettext
514 import gettext
515 gettext.install('myapplication')
520 import gettext
521 gettext.install('myapplication', '/usr/share/locale')
531 import gettext
533 lang1 = gettext.translation('myapplication', languages=['en'])
534 lang2 = gettext.translation('myapplication', languages=['fr'])
535 lang3 = gettext.translation('myapplication', languages=['de'])
590 translatable to the :program:`gettext` program, because the parameter
643 The :mod:`gettext` module does not try to support these system dependent