# gettext - pydoc - phpman

> **TLDR:** Translates a string using stored translations in a compiled `.mo` file.
>
- Get the translation of a string as specified in the domain file (falls back to given `msgid` if no translation exists):
  `LANGUAGE={{locale}} gettext {{-d|--domain}} {{domain}} "{{msgid}}"`
- Display help:
  `gettext {{-h|--help}}`
- Display version:
  `gettext {{-V|--version}}`

*Source: tldr-pages*

---

Help on module gettext:

## NAME
    gettext - Internationalization and localization support.

## MODULE REFERENCE
    <https://docs.python.org/3.10/library/gettext.html>

    The following documentation is automatically generated from the Python
    source files.  It may be incomplete, incorrect or include features that
    are considered implementation detail and may vary between Python
    implementations.  When in doubt, consult the module reference at the
    location listed above.

## DESCRIPTION
    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.

## CLASSES
    builtins.object
        NullTranslations
            GNUTranslations

### class GNUTranslations
     |  GNUTranslations(fp=None)
     |
     |  Method resolution order:
     |      GNUTranslations
     |      NullTranslations
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  gettext(self, message)
     |
     |  lgettext(self, message)
     |
     |  lngettext(self, msgid1, msgid2, n)
     |
     |  ngettext(self, msgid1, msgid2, n)
     |
     |  npgettext(self, context, msgid1, msgid2, n)
     |
     |  pgettext(self, context, message)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  BE_MAGIC = 3725722773
     |
     |  CONTEXT = '%s\x04%s'
     |
     |  LE_MAGIC = 2500072158
     |
     |  VERSIONS = (0, 1)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from NullTranslations:
     |
     |  __init__(self, fp=None)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  add_fallback(self, fallback)
     |
     |  charset(self)
     |
     |  info(self)
     |
     |  install(self, names=None)
     |
     |  output_charset(self)
     |
     |  set_output_charset(self, charset)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from NullTranslations:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

### class NullTranslations
     |  NullTranslations(fp=None)
     |
     |  Methods defined here:
     |
     |  __init__(self, fp=None)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  add_fallback(self, fallback)
     |
     |  charset(self)
     |
     |  gettext(self, message)
     |
     |  info(self)
     |
     |  install(self, names=None)
     |
     |  lgettext(self, message)
     |
     |  lngettext(self, msgid1, msgid2, n)
     |
     |  ngettext(self, msgid1, msgid2, n)
     |
     |  npgettext(self, context, msgid1, msgid2, n)
     |
     |  output_charset(self)
     |
     |  pgettext(self, context, message)
     |
     |  set_output_charset(self, charset)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)

## FUNCTIONS
    Catalog = translation(domain, localedir=None, languages=None, class_=None, fallback=False, codeset=['unspecified'])

### bind_textdomain_codeset

### bindtextdomain

### dgettext

### dngettext

### dnpgettext

### dpgettext

### find
        # Locate a .mo file using the gettext strategy

### gettext

### install

### ldgettext

### ldngettext

### lgettext

### lngettext

### ngettext

### npgettext

### pgettext

### textdomain

### translation

## DATA
    __all__ = ['NullTranslations', 'GNUTranslations', 'Catalog', 'find', '...

## FILE
    /usr/lib/python3.10/gettext.py


