Specialized gettext Subclasses (hoshi.translations)ΒΆ

These classes are used internally to modify the behavior of gettext.

Most applications would not need to touch this module directly.

exception hoshi.translation.TranslationMissingError(msg)[source]

Bases: Exception

An exception that is raised if an attempt to translate a string did not find a suitable translation to return. This may happen because the msgid does not exist in the template, or if the translation in the catalog is blank.

class hoshi.translation.FailingFallback(fp=None)[source]

Bases: gettext.NullTranslations

gettext.NullTranslations subclass which simply raises a TranslationMissingError. When used as a Fallback Translation, this results in the exception being thrown whenever translations are missing.

gettext(message)[source]
class hoshi.translation.StrictTranslations(*args, **kwargs)[source]

Bases: gettext.GNUTranslations, object

gettext.GNUTranslations subclass which uses the FailingFallback This is used by the hoshi.TranslationManager to provide its functionality.