gettext.ngettext()

gettext.ngettext(singular, plural, n) Like gettext(), but consider plural forms. If a translation is found, apply the plural formula to n, and return the resulting message (some languages have more than two plural forms). If no translation is found, return singular if n is 1; return plural otherwise. The Plural formula is taken from the catalog header. It is a C or Python expression that has a free variable n; the expression evaluates to the index of the plural in the catalog. See the GNU ge

gettext.install()

gettext.install(domain, localedir=None, codeset=None, names=None) This installs the function _() in Python’s builtins namespace, based on domain, localedir, and codeset which are passed to the function translation(). For the names parameter, please see the description of the translation object’s install() method. As seen below, you usually mark the strings in your application that are candidates for translation, by wrapping them in a call to the _() function, like this: print(_('This string

gettext.lgettext()

gettext.lgettext(message) Equivalent to gettext(), but the translation is returned in the preferred system encoding, if no other encoding was explicitly set with bind_textdomain_codeset().

gettext.ldgettext()

gettext.ldgettext(domain, message) Equivalent to dgettext(), but the translation is returned in the preferred system encoding, if no other encoding was explicitly set with bind_textdomain_codeset().

gettext.GNUTranslations.ngettext()

GNUTranslations.ngettext(singular, plural, n) Do a plural-forms lookup of a message id. singular is used as the message id for purposes of lookup in the catalog, while n is used to determine which plural form to use. The returned message string is a Unicode string. If the message id is not found in the catalog, and a fallback is specified, the request is forwarded to the fallback’s ngettext() method. Otherwise, when n is 1 singular is returned, and plural is returned in all other cases. Here

gettext.ldngettext()

gettext.ldngettext(domain, singular, plural, n) Equivalent to dngettext(), but the translation is returned in the preferred system encoding, if no other encoding was explicitly set with bind_textdomain_codeset().

gettext.lngettext()

gettext.lngettext(singular, plural, n) Equivalent to ngettext(), but the translation is returned in the preferred system encoding, if no other encoding was explicitly set with bind_textdomain_codeset().

gettext.dngettext()

gettext.dngettext(domain, singular, plural, n) Like ngettext(), but look the message up in the specified domain.

gettext.GNUTranslations.lgettext()

GNUTranslations.lgettext(message) Equivalent to gettext(), but the translation is returned as a bytestring encoded in the selected output charset, or in the preferred system encoding if no encoding was explicitly set with set_output_charset().

gettext.gettext()

gettext.gettext(message) Return the localized translation of message, based on the current global domain, language, and locale directory. This function is usually aliased as _() in the local namespace (see examples below).