Sun, 08 Jul 2018 13:05:23 +0200
Translator: improved the translator by making the loading of available translations an asynchroneous operation.
<!DOCTYPE html> <html><head> <title>eric6.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.TranslationEngine</title> <meta charset="UTF-8"> <style> body { background: #EDECE6; margin: 0em 1em 10em 1em; color: black; } h1 { color: white; background: #85774A; } h2 { color: white; background: #85774A; } h3 { color: white; background: #9D936E; } h4 { color: white; background: #9D936E; } a { color: #BA6D36; } </style> </head> <body><a NAME="top" ID="top"></a> <h1>eric6.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.TranslationEngine</h1> <p> Module implementing the translation engine base class. </p> <h3>Global Attributes</h3> <table> <tr><td>None</td></tr> </table> <h3>Classes</h3> <table> <tr> <td><a href="#TranslationEngine">TranslationEngine</a></td> <td>Class implementing the translation engine base class containing default methods.</td> </tr> </table> <h3>Functions</h3> <table> <tr><td>None</td></tr> </table> <hr /><hr /> <a NAME="TranslationEngine" ID="TranslationEngine"></a> <h2>TranslationEngine</h2> <p> Class implementing the translation engine base class containing default methods. </p><h3>Signals</h3> <dl> <dt>availableTranslationsLoaded()</dt> <dd> emitted to indicate the availability of the list of supported translation languages </dd> </dl> <h3>Derived from</h3> QObject <h3>Class Attributes</h3> <table> <tr><td>None</td></tr> </table> <h3>Class Methods</h3> <table> <tr><td>None</td></tr> </table> <h3>Methods</h3> <table> <tr> <td><a href="#TranslationEngine.__init__">TranslationEngine</a></td> <td>Constructor</td> </tr><tr> <td><a href="#TranslationEngine.engineName">engineName</a></td> <td>Public method to get the name of the engine.</td> </tr><tr> <td><a href="#TranslationEngine.getTextToSpeechData">getTextToSpeechData</a></td> <td>Public method to pronounce the given text.</td> </tr><tr> <td><a href="#TranslationEngine.getTranslation">getTranslation</a></td> <td>Public method to translate the given text.</td> </tr><tr> <td><a href="#TranslationEngine.hasTTS">hasTTS</a></td> <td>Public method indicating the Text-to-Speech capability.</td> </tr><tr> <td><a href="#TranslationEngine.supportedLanguages">supportedLanguages</a></td> <td>Public method to get the supported languages.</td> </tr><tr> <td><a href="#TranslationEngine.supportedTargetLanguages">supportedTargetLanguages</a></td> <td>Public method to get a list of supported target languages for an original language.</td> </tr> </table> <h3>Static Methods</h3> <table> <tr><td>None</td></tr> </table> <a NAME="TranslationEngine.__init__" ID="TranslationEngine.__init__"></a> <h4>TranslationEngine (Constructor)</h4> <b>TranslationEngine</b>(<i>plugin, parent=None</i>) <p> Constructor </p><dl> <dt><i>plugin</i></dt> <dd> reference to the plugin object (TranslatorPlugin) </dd><dt><i>parent</i></dt> <dd> reference to the parent object (QObject) </dd> </dl><a NAME="TranslationEngine.engineName" ID="TranslationEngine.engineName"></a> <h4>TranslationEngine.engineName</h4> <b>engineName</b>(<i></i>) <p> Public method to get the name of the engine. </p><dl> <dt>Returns:</dt> <dd> engine name (string) </dd> </dl><a NAME="TranslationEngine.getTextToSpeechData" ID="TranslationEngine.getTextToSpeechData"></a> <h4>TranslationEngine.getTextToSpeechData</h4> <b>getTextToSpeechData</b>(<i>requestObject, text, language</i>) <p> Public method to pronounce the given text. </p><dl> <dt><i>requestObject</i></dt> <dd> reference to the request object (TranslatorRequest) </dd><dt><i>text</i></dt> <dd> text to be pronounced (string) </dd><dt><i>language</i></dt> <dd> language code of the text (string) </dd> </dl><dl> <dt>Returns:</dt> <dd> tuple with pronounce data (QByteArray) or error string (string) and success flag (boolean) </dd> </dl><a NAME="TranslationEngine.getTranslation" ID="TranslationEngine.getTranslation"></a> <h4>TranslationEngine.getTranslation</h4> <b>getTranslation</b>(<i>requestObject, text, originalLanguage, translationLanguage</i>) <p> Public method to translate the given text. </p><dl> <dt><i>requestObject</i></dt> <dd> reference to the request object (TranslatorRequest) </dd><dt><i>text</i></dt> <dd> text to be translated (string) </dd><dt><i>originalLanguage</i></dt> <dd> language code of the original (string) </dd><dt><i>translationLanguage</i></dt> <dd> language code of the translation (string) </dd> </dl><dl> <dt>Returns:</dt> <dd> tuple of translated text (string) and flag indicating success (boolean) </dd> </dl><a NAME="TranslationEngine.hasTTS" ID="TranslationEngine.hasTTS"></a> <h4>TranslationEngine.hasTTS</h4> <b>hasTTS</b>(<i></i>) <p> Public method indicating the Text-to-Speech capability. </p><dl> <dt>Returns:</dt> <dd> flag indicating the Text-to-Speech capability (boolean) </dd> </dl><a NAME="TranslationEngine.supportedLanguages" ID="TranslationEngine.supportedLanguages"></a> <h4>TranslationEngine.supportedLanguages</h4> <b>supportedLanguages</b>(<i></i>) <p> Public method to get the supported languages. </p><dl> <dt>Returns:</dt> <dd> list of supported language codes (list of string) </dd> </dl><a NAME="TranslationEngine.supportedTargetLanguages" ID="TranslationEngine.supportedTargetLanguages"></a> <h4>TranslationEngine.supportedTargetLanguages</h4> <b>supportedTargetLanguages</b>(<i>original</i>) <p> Public method to get a list of supported target languages for an original language. </p><p> Note: The default implementation return the list of supported languages (i.e. the same as those for the source) with the given original removed. </p><dl> <dt><i>original</i> (str)</dt> <dd> original language </dd> </dl><dl> <dt>Returns:</dt> <dd> list of supported target languages for the given original </dd> </dl><dl> <dt>Return Type:</dt> <dd> list of str </dd> </dl> <div align="right"><a href="#top">Up</a></div> <hr /> </body></html>