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