Python gettext Module
Example
Use gettext without translations (falls back to the original string):
import gettext
_ = gettext.gettext
print(_("Hello, Tobias"))
Try it Yourself »
Definition and Usage
The gettext module provides internationalization (i18n) and localization (l10n) support.
Use it to mark strings for translation and load compiled message catalogs at runtime.
Members
Member | Description |
---|---|
gettext() | Translate a message id using the current catalog. |
ngettext() | Plural-aware translation function. |
translation() | Load a translation catalog. |
NullTranslations | A translation object that returns messages unchanged. |