eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.MicrosoftEngine
Module implementing the Microsoft translation engine.
Global Attributes
Classes
MicrosoftEngine |
Class implementing the translation engine for the Microsoft translation service. |
Functions
createEngine |
Function to instantiate a translator engine object. |
MicrosoftEngine
Class implementing the translation engine for the Microsoft
translation service.
Derived from
TranslationEngine
Class Attributes
Class Methods
Methods
Static Methods
MicrosoftEngine (Constructor)
MicrosoftEngine(plugin, parent=None)
Constructor
- plugin (TranslatorPlugin)
-
reference to the plugin object
- parent (QObject)
-
reference to the parent object
MicrosoftEngine.__getClientDataAzure
__getClientDataAzure()
Private method to retrieve the client data.
- Return:
-
tuple giving the API subscription key, the API subscription
region and a flag indicating validity
- Return Type:
-
tuple of (str, str, bool)
MicrosoftEngine.__mapLanguageCode
__mapLanguageCode(code)
Private method to map a language code to the Microsoft code.
- code (str)
-
language code
- Return:
-
mapped language code
- Return Type:
-
str
MicrosoftEngine.engineName
engineName()
Public method to return the name of the engine.
- Return:
-
engine name
- Return Type:
-
str
MicrosoftEngine.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)
MicrosoftEngine.supportedLanguages
supportedLanguages()
Public method to get the supported languages.
- Return:
-
list of supported language codes
- Return Type:
-
list of str
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:
-
MicrosoftEngine