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.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.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.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.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.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.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.GNUTranslations.lngettext()

GNUTranslations.lngettext(singular, plural, n) 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.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.GNUTranslations.gettext()

GNUTranslations.gettext(message) Look up the message id in the catalog and return the corresponding message string, as a Unicode string. If there is no entry in the catalog for the message id, and a fallback has been set, the look up is forwarded to the fallback’s gettext() method. Otherwise, the message id is returned.