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 the source_language, return the string as translated into the target_language. Both languages are to be instances of babel.core.Locale.