External Translator Adapter Base (hoshi.translators.base
)ΒΆ
This module provides the prototypes for integration of external translators.
- exception hoshi.translators.base.TranslationFailure[source]
Bases:
Exception
The Exception to be raised when a translation request fails for any reason.
- class hoshi.translators.base.TranslatorBase[source]
Bases:
object
Any initialization required to start or connect to the external translator should be done here.
- translate(source_language, target_language, string)[source]
Given a
string
in thesource_language
, return the string as translated into thetarget_language
. Both languages are to be instances ofbabel.core.Locale
.