Home ⌂Doc Index ◂Up ▴

eric6.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.TranslationEngine

Module implementing the translation engine base class.

Global Attributes

None

Classes

TranslationEngine Class implementing the translation engine base class containing default methods.

Functions

None


TranslationEngine

Class implementing the translation engine base class containing default methods.

Signals

availableTranslationsLoaded()
emitted to indicate the availability of the list of supported translation languages

Derived from

QObject

Class Attributes

None

Class Methods

None

Methods

TranslationEngine Constructor
engineName Public method to get the name of the engine.
getTextToSpeechData Public method to pronounce the given text.
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

TranslationEngine (Constructor)

TranslationEngine(plugin, parent=None)

Constructor

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

TranslationEngine.engineName

engineName()

Public method to get the name of the engine.

Returns:
engine name (string)

TranslationEngine.getTextToSpeechData

getTextToSpeechData(requestObject, text, language)

Public method to pronounce the given text.

requestObject
reference to the request object (TranslatorRequest)
text
text to be pronounced (string)
language
language code of the text (string)
Returns:
tuple with pronounce data (QByteArray) or error string (string) and success flag (boolean)

TranslationEngine.getTranslation

getTranslation(requestObject, text, originalLanguage, translationLanguage)

Public method to translate the given text.

requestObject
reference to the request object (TranslatorRequest)
text
text to be translated (string)
originalLanguage
language code of the original (string)
translationLanguage
language code of the translation (string)
Returns:
tuple of translated text (string) and flag indicating success (boolean)

TranslationEngine.hasTTS

hasTTS()

Public method indicating the Text-to-Speech capability.

Returns:
flag indicating the Text-to-Speech capability (boolean)

TranslationEngine.supportedLanguages

supportedLanguages()

Public method to get the supported languages.

Returns:
list of supported language codes (list of string)

TranslationEngine.supportedTargetLanguages

supportedTargetLanguages(original)

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

Note: The default implementation return the list of supported languages (i.e. the same as those for the source) with the given original removed.

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



Home ⌂Doc Index ◂Up ▴