class NullTranslations(gettext.NullTranslations): (source)
Known subclasses: babel.support.Translations
Undocumented
Method | __init__ |
Initialize a simple translations class which is not backed by a real catalog. Behaves similar to gettext.NullTranslations but also offers Babel's on *gettext methods (e.g. 'dgettext()'). |
Method | dgettext |
Like ``gettext()``, but look the message up in the specified domain. |
Method | dngettext |
Like ``ngettext()``, but look the message up in the specified domain. |
Method | dnpgettext |
Like ``npgettext``, but look the message up in the specified `domain`. |
Method | dpgettext |
Like `pgettext()`, but look the message up in the specified `domain`. |
Method | ldgettext |
Like ``lgettext()``, but look the message up in the specified domain. |
Method | ldngettext |
Like ``lngettext()``, but look the message up in the specified domain. |
Method | ldnpgettext |
Equivalent to ``dnpgettext()``, but the translation is returned in the preferred system encoding, if no other encoding was explicitly set with ``bind_textdomain_codeset()``. |
Method | ldpgettext |
Equivalent to ``dpgettext()``, but the translation is returned in the preferred system encoding, if no other encoding was explicitly set with ``bind_textdomain_codeset()``. |
Method | lnpgettext |
Equivalent to ``npgettext()``, but the translation is returned in the preferred system encoding, if no other encoding was explicitly set with ``bind_textdomain_codeset()``. |
Method | lpgettext |
Equivalent to ``pgettext()``, but the translation is returned in the preferred system encoding, if no other encoding was explicitly set with ``bind_textdomain_codeset()``. |
Method | npgettext |
Do a plural-forms lookup of a message id. `singular` is used as the message id for purposes of lookup in the catalog, while `num` is used to determine which plural form to use. The returned message string is an 8-bit string encoded with the catalog's charset encoding, if known. |
Method | pgettext |
Look up the `context` and `message` id in the catalog and return the corresponding message string, as an 8-bit string encoded with the catalog's charset encoding, if known. If there is no entry in the catalog for the `message` id and `context` , and a fallback has been set, the look up is forwarded to the fallback's ``pgettext()`` method... |
Method | udgettext |
Like ``ugettext()``, but look the message up in the specified domain. |
Method | udngettext |
Like ``ungettext()`` but look the message up in the specified domain. |
Method | udnpgettext |
Like ``unpgettext``, but look the message up in the specified `domain`. |
Method | udpgettext |
Like `upgettext()`, but look the message up in the specified `domain`. |
Method | unpgettext |
Do a plural-forms lookup of a message id. `singular` is used as the message id for purposes of lookup in the catalog, while `num` is used to determine which plural form to use. The returned message string is a Unicode string. |
Method | upgettext |
Look up the `context` and `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 `context`, and a fallback has been set, the look up is forwarded to the fallback's ``upgettext()`` method... |
Constant | CONTEXT |
Undocumented |
Constant | DEFAULT |
Undocumented |
Instance Variable | domain |
Undocumented |
Instance Variable | files |
Undocumented |
Instance Variable | plural |
Undocumented |
Class Variable | _fallback |
Undocumented |
Class Variable | _info |
Undocumented |
Instance Variable | _catalog |
Undocumented |
Instance Variable | _domains |
Undocumented |
babel.support.Translations
Initialize a simple translations class which is not backed by a real catalog. Behaves similar to gettext.NullTranslations but also offers Babel's on *gettext methods (e.g. 'dgettext()'). :param fp: a file-like object (ignored in this class)
str
, context: str
, singular: str
, plural: str
, num: int
) -> str
:
(source)
¶
Like ``npgettext``, but look the message up in the specified `domain`.
str
, context: str
, singular: str
, plural: str
, num: int
) -> str|bytes
:
(source)
¶
Equivalent to ``dnpgettext()``, but the translation is returned in the preferred system encoding, if no other encoding was explicitly set with ``bind_textdomain_codeset()``.
Equivalent to ``dpgettext()``, but the translation is returned in the preferred system encoding, if no other encoding was explicitly set with ``bind_textdomain_codeset()``.
Equivalent to ``npgettext()``, but the translation is returned in the preferred system encoding, if no other encoding was explicitly set with ``bind_textdomain_codeset()``.
Equivalent to ``pgettext()``, but the translation is returned in the preferred system encoding, if no other encoding was explicitly set with ``bind_textdomain_codeset()``.
Do a plural-forms lookup of a message id. `singular` is used as the message id for purposes of lookup in the catalog, while `num` is used to determine which plural form to use. The returned message string is an 8-bit string encoded with the catalog's charset encoding, if known. If the message id for `context` is not found in the catalog, and a fallback is specified, the request is forwarded to the fallback's ``npgettext()`` method. Otherwise, when ``num`` is 1 ``singular`` is returned, and ``plural`` is returned in all other cases.
Look up the `context` and `message` id in the catalog and return the corresponding message string, as an 8-bit string encoded with the catalog's charset encoding, if known. If there is no entry in the catalog for the `message` id and `context` , and a fallback has been set, the look up is forwarded to the fallback's ``pgettext()`` method. Otherwise, the `message` id is returned.
str
, context: str
, singular: str
, plural: str
, num: int
) -> str
:
(source)
¶
Like ``unpgettext``, but look the message up in the specified `domain`.
Do a plural-forms lookup of a message id. `singular` is used as the message id for purposes of lookup in the catalog, while `num` is used to determine which plural form to use. The returned message string is a Unicode string. If the message id for `context` is not found in the catalog, and a fallback is specified, the request is forwarded to the fallback's ``unpgettext()`` method. Otherwise, when `num` is 1 `singular` is returned, and `plural` is returned in all other cases.
Look up the `context` and `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 `context`, and a fallback has been set, the look up is forwarded to the fallback's ``upgettext()`` method. Otherwise, the `message` id is returned.