eric7/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/TranslationEngine.py

branch
eric7
changeset 9148
b31f0d894b55
parent 8881
54e42bc2437a
equal deleted inserted replaced
9147:bbf3af40c223 9148:b31f0d894b55
24 24
25 def __init__(self, plugin, parent=None): 25 def __init__(self, plugin, parent=None):
26 """ 26 """
27 Constructor 27 Constructor
28 28
29 @param plugin reference to the plugin object (TranslatorPlugin) 29 @param plugin reference to the plugin object
30 @param parent reference to the parent object (QObject) 30 @type TranslatorPlugin
31 @param parent reference to the parent object
32 @type QObject
31 """ 33 """
32 super().__init__(parent) 34 super().__init__(parent)
33 35
34 self.plugin = plugin 36 self.plugin = plugin
35 37
36 def engineName(self): 38 def engineName(self):
37 """ 39 """
38 Public method to get the name of the engine. 40 Public method to get the name of the engine.
39 41
40 @return engine name (string) 42 @return engine name
43 @rtype str
41 """ 44 """
42 return "" 45 return ""
43 46
44 def supportedLanguages(self): 47 def supportedLanguages(self):
45 """ 48 """
46 Public method to get the supported languages. 49 Public method to get the supported languages.
47 50
48 @return list of supported language codes (list of string) 51 @return list of supported language codes
52 @rtype list of str
49 """ 53 """
50 return [] 54 return []
51 55
52 def supportedTargetLanguages(self, original): 56 def supportedTargetLanguages(self, original):
53 """ 57 """
71 75
72 def hasTTS(self): 76 def hasTTS(self):
73 """ 77 """
74 Public method indicating the Text-to-Speech capability. 78 Public method indicating the Text-to-Speech capability.
75 79
76 @return flag indicating the Text-to-Speech capability (boolean) 80 @return flag indicating the Text-to-Speech capability
81 @rtype bool
77 """ 82 """
78 return False 83 return False
79 84
80 def getTextToSpeechData(self, requestObject, text, language): 85 def getTextToSpeechData(self, requestObject, text, language):
81 """ 86 """
82 Public method to pronounce the given text. 87 Public method to pronounce the given text.
83 88
84 @param requestObject reference to the request object 89 @param requestObject reference to the request object
85 (TranslatorRequest) 90 @type TranslatorRequest
86 @param text text to be pronounced (string) 91 @param text text to be pronounced
87 @param language language code of the text (string) 92 @type str
88 @return tuple with pronounce data (QByteArray) or error string (string) 93 @param language language code of the text
89 and success flag (boolean) 94 @type str
95 @return tuple with pronounce data or an error string and a success flag
96 @rtype tuple of (QByteArray or str, bool)
90 """ 97 """
91 return self.tr("No pronounce data available"), False 98 return self.tr("No pronounce data available"), False
92 99
93 def getTranslation(self, requestObject, text, originalLanguage, 100 def getTranslation(self, requestObject, text, originalLanguage,
94 translationLanguage): 101 translationLanguage):
95 """ 102 """
96 Public method to translate the given text. 103 Public method to translate the given text.
97 104
98 @param requestObject reference to the request object 105 @param requestObject reference to the request object
99 (TranslatorRequest) 106 @type TranslatorRequest
100 @param text text to be translated (string) 107 @param text text to be translated
101 @param originalLanguage language code of the original (string) 108 @type str
102 @param translationLanguage language code of the translation (string) 109 @param originalLanguage language code of the original
103 @return tuple of translated text (string) and flag indicating 110 @type str
104 success (boolean) 111 @param translationLanguage language code of the translation
112 @type str
113 @return tuple of translated text and flag indicating success
114 @rtype tuple of (str, bool)
105 """ 115 """
106 return self.tr("No translation available"), False 116 return self.tr("No translation available"), False

eric ide

mercurial