--- a/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/GoogleV1Engine.py Mon Aug 16 19:46:20 2021 +0200 +++ b/eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/GoogleV1Engine.py Tue Aug 17 12:17:11 2021 +0200 @@ -30,8 +30,10 @@ """ Constructor - @param plugin reference to the plugin object (TranslatorPlugin) - @param parent reference to the parent object (QObject) + @param plugin reference to the plugin object + @type TranslatorPlugin + @param parent reference to the parent object + @type QObject """ super().__init__(plugin, parent) @@ -41,7 +43,8 @@ """ Public method to return the name of the engine. - @return engine name (string) + @return engine name + @rtype str """ return "googlev1" @@ -49,7 +52,8 @@ """ Public method to get the supported languages. - @return list of supported language codes (list of string) + @return list of supported language codes + @rtype list of str """ return ["ar", "be", "bg", "bs", "ca", "cs", "da", "de", "el", "en", "es", "et", "fi", "fr", "ga", "gl", "hi", "hr", "hu", "id", @@ -62,9 +66,10 @@ """ Public method indicating the Text-to-Speech capability. - @return flag indicating the Text-to-Speech capability (boolean) + @return flag indicating the Text-to-Speech capability + @rtype bool """ - return False # doesn't work reliably + return True def getTranslation(self, requestObject, text, originalLanguage, translationLanguage): @@ -72,12 +77,15 @@ Public method to translate the given text. @param requestObject reference to the request object - (TranslatorRequest) - @param text text to be translated (string) - @param originalLanguage language code of the original (string) - @param translationLanguage language code of the translation (string) - @return tuple of translated text (string) and flag indicating - success (boolean) + @type TranslatorRequest + @param text text to be translated + @type str + @param originalLanguage language code of the original + @type str + @param translationLanguage language code of the translation + @type str + @return tuple of translated text and flag indicating success + @rtype tuple of (str, bool) """ params = QByteArray( "client=gtx&sl={0}&tl={1}&dt=t&dt=bd&ie=utf-8&oe=utf-8&q=".format( @@ -151,11 +159,13 @@ Public method to pronounce the given text. @param requestObject reference to the request object - (TranslatorRequest) - @param text text to be pronounced (string) - @param language language code of the text (string) - @return tuple with pronounce data (QByteArray) or error string (string) - and success flag (boolean) + @type TranslatorRequest + @param text text to be pronounced + @type str + @param language language code of the text + @type str + @return tuple with pronounce data or error string and success flag + @rtype tuple of (QByteArray or str, bool) """ text = text.split("\n\n", 1)[0] if len(text) > self.TextToSpeechLimit: