On this page
gettext.NullTranslations
Prev: gettext.npgettext | Up: gettext | Next: gettext.pgettext
Rel: gettext.bindtextdomain, gettext.Catalog, gettext.dgettext, gettext.dngettext
Ref: docs.python.org — gettext.NullTranslations
Tags: #public #python3 #stdlib #gettext
Import
import gettext
from gettext import NullTranslations
Signature & Overview
gettext.NullTranslations(fp=None)
gettext.NullTranslations class.
Methods & Attributes
NullTranslations.add_fallback(self, fallback)—NullTranslations.add_fallbackmethod/property.NullTranslations.charset(self)—NullTranslations.charsetmethod/property.NullTranslations.gettext(self, message)—NullTranslations.gettextmethod/property.NullTranslations.info(self)—NullTranslations.infomethod/property.NullTranslations.install(self, names=None)—NullTranslations.installmethod/property.NullTranslations.ngettext(self, msgid1, msgid2, n)—NullTranslations.ngettextmethod/property.NullTranslations.npgettext(self, context, msgid1, msgid2, n)—NullTranslations.npgettextmethod/property.NullTranslations.pgettext(self, context, message)—NullTranslations.pgettextmethod/property.
Usage
import gettext
t = gettext.NullTranslations()
assert t.gettext("Save") == "Save"
assert t.ngettext("%d item", "%d items", 2) == "%d items"
Gotchas
- No-op fallback class returned by
gettext.translation(..., fallback=True)when no.mofile exists.
REPL Inspect
from gettext import NullTranslations
help(NullTranslations)
Linked from
Related notes
- tuts/python3/stdlib_module/gettext/npgettext Linked here; links to this page; shared tags: #gettext, #stdlib
- tuts/python3/stdlib_module/gettext/pgettext Linked here; links to this page; shared tags: #gettext, #stdlib
- tuts/python3/stdlib_module/gettext/bindtextdomain Linked here; shared tags: #gettext, #stdlib
- tuts/python3/stdlib_module/gettext/Catalog Linked here; shared tags: #gettext, #stdlib
- tuts/python3/stdlib_module/gettext/dgettext Linked here; shared tags: #gettext, #stdlib
- tuts/python3/stdlib_module/gettext/dngettext Linked here; shared tags: #gettext, #stdlib
- tuts/python3/stdlib_module/gettext/gettext Linked here; shared tags: #gettext, #stdlib
- tuts/python3/stdlib_module/gettext links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/gettext/dnpgettext shared tags: #gettext, #stdlib
- tuts/python3/stdlib_module/gettext/dpgettext shared tags: #gettext, #stdlib