eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.LibreTranslateEngine

Module implementing the LibreTranslate translation engine.

Global Attributes

None

Classes

LibreTranslateEngine Class implementing the translation engine for the LibreTranslate service.

Functions

createEngine Function to instantiate a translator engine object.


LibreTranslateEngine

Class implementing the translation engine for the LibreTranslate service.

Derived from

TranslationEngine

Class Attributes

None

Class Methods

None

Methods

LibreTranslateEngine Constructor
__getTranslationModels Private method to get the translation models supported by IBM Watson Language Translator.
__getTranslationModelsReplyFinished Private slot handling the receipt of the available translations.
engineName Public method to return the name of the engine.
getTranslation Public method to translate the given text.
hasTTS Public method indicating the Text-to-Speech capability.
supportedLanguages Public method to get the supported languages.
supportedTargetLanguages Public method to get a list of supported target languages for an original language.

Static Methods

None

LibreTranslateEngine (Constructor)

LibreTranslateEngine(plugin, parent=None)

Constructor

plugin (TranslatorPlugin)
reference to the plugin object
parent (QObject)
reference to the parent object

LibreTranslateEngine.__getTranslationModels

__getTranslationModels()

Private method to get the translation models supported by IBM Watson Language Translator.

LibreTranslateEngine.__getTranslationModelsReplyFinished

__getTranslationModelsReplyFinished(reply)

Private slot handling the receipt of the available translations.

reply (QNetworkReply)
reference to the network reply object

LibreTranslateEngine.engineName

engineName()

Public method to return the name of the engine.

Return:
engine name
Return Type:
str

LibreTranslateEngine.getTranslation

getTranslation(requestObject, text, originalLanguage, translationLanguage)

Public method to translate the given text.

requestObject (TranslatorRequest)
reference to the request object
text (str)
text to be translated
originalLanguage (str)
language code of the original
translationLanguage (str)
language code of the translation
Return:
tuple of translated text and flag indicating success
Return Type:
tuple of (str, bool)

LibreTranslateEngine.hasTTS

hasTTS()

Public method indicating the Text-to-Speech capability.

Return:
flag indicating the Text-to-Speech capability
Return Type:
bool

LibreTranslateEngine.supportedLanguages

supportedLanguages()

Public method to get the supported languages.

Return:
list of supported language codes
Return Type:
list of str

LibreTranslateEngine.supportedTargetLanguages

supportedTargetLanguages(original)

Public method to get a list of supported target languages for an original language.

original (str)
original language
Return:
list of supported target languages for the given original
Return Type:
list of str
Up


createEngine

createEngine(plugin, parent=None)

Function to instantiate a translator engine object.

plugin (TranslatorPlugin)
reference to the plugin object
parent (QObject (optional))
reference to the parent object (defaults to None)
Return:
reference to the instantiated translator engine object
Return Type:
IbmWatsonEngine
Up