PyDocs

Internationalization

Internationalization

gettext

Internationalization and localization support.

This module provides internationalization (I18N) and localization (L10N)
support for your Python programs by providing an interface to the GNU gettext
message catalog library.

I18N refers to the operation by which a program is made aware of multiple
languages.  L10N refers to the adaptation of your program, once
internationalized, to the local language and cultural habits.
Symbols in gettext

b

bindtextdomain
Bind the domain to the locale directory localedir.

d

dgettext
Like gettext(), but look the message up in the specified domain.
dngettext
Like ngettext(), but look the message up in the specified domain.
dnpgettext
Similar to the corresponding functions without the p in the prefix (that is, gettext(), dgettext(), ngettext(), dngettext()), but the translation is restricted to the given message context.
dpgettext
Similar to the corresponding functions without the p in the prefix (that is, gettext(), dgettext(), ngettext(), dngettext()), but the translation is restricted to the given message context.

f

find
This function implements the standard .mo file search algorithm.

g

gettext
Return the localized translation of message, based on the current global domain, language, and locale directory.
GNUTranslations
The following methods are overridden from the base class implementation:

i

install
This installs the function _() in Python’s builtins namespace, based on domain and localedir which are passed to the function translation().

n

ngettext
Like gettext(), but consider plural forms.
npgettext
Similar to the corresponding functions without the p in the prefix (that is, gettext(), dgettext(), ngettext(), dngettext()), but the translation is restricted to the given message context.
NullTranslations
Takes an optional file object fp, which is ignored by the base class.

p

pgettext
Similar to the corresponding functions without the p in the prefix (that is, gettext(), dgettext(), ngettext(), dngettext()), but the translation is restricted to the given message context.

t

textdomain
Change or query the current global domain.
translation
Return a *Translations instance based on the domain, localedir, and languages, which are first passed to find() to get a list of the associated .mo file paths.