Lines Matching full:gettext
1 :mod:`gettext` --- Multilingual internationalization services
4 .. module:: gettext
9 **Source code:** :source:`Lib/gettext.py`
13 The :mod:`gettext` module provides internationalization (I18N) and localization
15 GNU ``gettext`` message catalog API and a higher level, class-based API that may
24 GNU :program:`gettext` API
27 The :mod:`gettext` module defines the following API, which is very similar to
28 the GNU :program:`gettext` API. If you use this API you will affect the
39 :mod:`gettext` will look for binary :file:`.mo` files for the given domain using
51 :func:`gettext` family of functions. If *codeset* is omitted, then the current
64 .. function:: gettext(message)
73 Equivalent to :func:`gettext`, but the translation is returned in the preferred
82 Like :func:`gettext`, but look the message up in the specified *domain*.
96 Like :func:`gettext`, but consider plural forms. If a translation is found,
103 of the plural in the catalog. See the GNU gettext documentation for the precise
134 Note that GNU :program:`gettext` also defines a :func:`dcgettext` method, but
139 import gettext
140 gettext.bindtextdomain('myapplication', '/path/to/my/language/directory')
141 gettext.textdomain('myapplication')
142 _ = gettext.gettext
150 The class-based API of the :mod:`gettext` module gives you more flexibility and
151 greater convenience than the GNU :program:`gettext` API. It is the recommended
152 way of localizing your Python applications and modules. :mod:`!gettext` defines
269 .. method:: gettext(message)
271 If a fallback has been set, forward :meth:`!gettext` to the
347 If the *unicode* flag is false, this method installs :meth:`self.gettext`
353 addition to :func:`_`. Supported names are ``'gettext'`` (bound to
354 :meth:`self.gettext` or :meth:`self.ugettext` according to the *unicode*
365 import gettext
366 t = gettext.translation('mymodule', ...)
367 _ = t.gettext
379 The :mod:`gettext` module provides one additional class derived from
381 :meth:`_parse` to enable reading GNU :program:`gettext` format :file:`.mo` files
386 catalog. It is convention with GNU :program:`gettext` to include meta-data as
394 :meth:`gettext` returns an encoded 8-bit string. For the message id arguments
410 .. method:: GNUTranslations.gettext(message)
415 has been set, the look up is forwarded to the fallback's :meth:`gettext` method.
421 Equivalent to :meth:`gettext`, but the translation is returned in the preferred
452 Equivalent to :meth:`gettext`, but the translation is returned in the preferred
495 GNOME uses a version of the :mod:`gettext` module by James Henstridge, but this
498 import gettext
499 cat = gettext.Catalog(domain, localedir)
500 _ = cat.gettext
526 #. use the :mod:`gettext` module so that message strings are properly translated
548 :program:`gettext` program except that it understands all the intricacies of
550 need GNU ``gettext`` unless you're also going to be translating C code (such as
568 The :file:`.mo` files are what the :mod:`gettext` module uses for the actual
571 How you use the :mod:`gettext` module in your code depends on whether you are
580 changes, e.g. to the built-in namespace. You should not use the GNU ``gettext``
585 :program:`gettext` format. Here's what you would put at the top of your
588 import gettext
589 t = gettext.translation('spam', '/usr/share/locale')
595 import gettext
596 t = gettext.translation('spam', '/usr/share/locale')
611 import gettext
612 gettext.install('myapplication')
617 import gettext
618 gettext.install('myapplication', '/usr/share/locale', unicode=1)
628 import gettext
630 lang1 = gettext.translation('myapplication', languages=['en'])
631 lang2 = gettext.translation('myapplication', languages=['fr'])
632 lang3 = gettext.translation('myapplication', languages=['de'])
710 :func:`gettext` vs. :func:`lgettext`
715 compliant with the current implementation of GNU gettext. Unlike
716 :func:`gettext`, which returns strings encoded with the same codeset used in the
722 would be expected in the GNU gettext implementation.
751 The :mod:`gettext` module does not try to support these system dependent
765 :program:`gettext` package to internationalize your Python applications.