eric7/Documentation/Source/eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.MicrosoftEngine.html

branch
eric7
changeset 8372
e0227a7c850e
child 8596
d64760b2da50
equal deleted inserted replaced
8371:d6062691d424 8372:e0227a7c850e
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.MicrosoftEngine</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body>
22 <a NAME="top" ID="top"></a>
23 <h1>eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.MicrosoftEngine</h1>
24
25 <p>
26 Module implementing the Microsoft translation engine.
27 </p>
28 <h3>Global Attributes</h3>
29
30 <table>
31 <tr><td>None</td></tr>
32 </table>
33 <h3>Classes</h3>
34
35 <table>
36
37 <tr>
38 <td><a href="#MicrosoftEngine">MicrosoftEngine</a></td>
39 <td>Class implementing the translation engine for the Microsoft translation service.</td>
40 </tr>
41 </table>
42 <h3>Functions</h3>
43
44 <table>
45 <tr><td>None</td></tr>
46 </table>
47 <hr />
48 <hr />
49 <a NAME="MicrosoftEngine" ID="MicrosoftEngine"></a>
50 <h2>MicrosoftEngine</h2>
51
52 <p>
53 Class implementing the translation engine for the Microsoft
54 translation service.
55 </p>
56 <h3>Derived from</h3>
57 TranslationEngine
58 <h3>Class Attributes</h3>
59
60 <table>
61 <tr><td>AccessTokenUrl</td></tr><tr><td>TextToSpeechUrl</td></tr><tr><td>TranslatorUrl</td></tr>
62 </table>
63 <h3>Class Methods</h3>
64
65 <table>
66 <tr><td>None</td></tr>
67 </table>
68 <h3>Methods</h3>
69
70 <table>
71
72 <tr>
73 <td><a href="#MicrosoftEngine.__init__">MicrosoftEngine</a></td>
74 <td>Constructor</td>
75 </tr>
76 <tr>
77 <td><a href="#MicrosoftEngine.__getAccessToken">__getAccessToken</a></td>
78 <td>Private slot to get an access token.</td>
79 </tr>
80 <tr>
81 <td><a href="#MicrosoftEngine.__getClientDataAzure">__getClientDataAzure</a></td>
82 <td>Private method to retrieve the client data.</td>
83 </tr>
84 <tr>
85 <td><a href="#MicrosoftEngine.__mapLanguageCode">__mapLanguageCode</a></td>
86 <td>Private method to map a language code to the Microsoft code.</td>
87 </tr>
88 <tr>
89 <td><a href="#MicrosoftEngine.engineName">engineName</a></td>
90 <td>Public method to return the name of the engine.</td>
91 </tr>
92 <tr>
93 <td><a href="#MicrosoftEngine.getTextToSpeechData">getTextToSpeechData</a></td>
94 <td>Public method to pronounce the given text.</td>
95 </tr>
96 <tr>
97 <td><a href="#MicrosoftEngine.getTranslation">getTranslation</a></td>
98 <td>Public method to translate the given text.</td>
99 </tr>
100 <tr>
101 <td><a href="#MicrosoftEngine.hasTTS">hasTTS</a></td>
102 <td>Public method indicating the Text-to-Speech capability.</td>
103 </tr>
104 <tr>
105 <td><a href="#MicrosoftEngine.supportedLanguages">supportedLanguages</a></td>
106 <td>Public method to get the supported languages.</td>
107 </tr>
108 </table>
109 <h3>Static Methods</h3>
110
111 <table>
112 <tr><td>None</td></tr>
113 </table>
114
115 <a NAME="MicrosoftEngine.__init__" ID="MicrosoftEngine.__init__"></a>
116 <h4>MicrosoftEngine (Constructor)</h4>
117 <b>MicrosoftEngine</b>(<i>plugin, parent=None</i>)
118
119 <p>
120 Constructor
121 </p>
122 <dl>
123
124 <dt><i>plugin</i></dt>
125 <dd>
126 reference to the plugin object (TranslatorPlugin)
127 </dd>
128 <dt><i>parent</i></dt>
129 <dd>
130 reference to the parent object (QObject)
131 </dd>
132 </dl>
133 <a NAME="MicrosoftEngine.__getAccessToken" ID="MicrosoftEngine.__getAccessToken"></a>
134 <h4>MicrosoftEngine.__getAccessToken</h4>
135 <b>__getAccessToken</b>(<i>requestObject</i>)
136
137 <p>
138 Private slot to get an access token.
139 </p>
140 <p>
141 If the stored token is no longer valid, get a new one and store it.
142 </p>
143 <dl>
144
145 <dt><i>requestObject</i></dt>
146 <dd>
147 reference to the request object
148 (TranslatorRequest)
149 </dd>
150 </dl>
151 <dl>
152 <dt>Return:</dt>
153 <dd>
154 access token (string)
155 </dd>
156 </dl>
157 <a NAME="MicrosoftEngine.__getClientDataAzure" ID="MicrosoftEngine.__getClientDataAzure"></a>
158 <h4>MicrosoftEngine.__getClientDataAzure</h4>
159 <b>__getClientDataAzure</b>(<i></i>)
160
161 <p>
162 Private method to retrieve the client data.
163 </p>
164 <dl>
165 <dt>Return:</dt>
166 <dd>
167 tuple giving the API subscription key and a flag indicating
168 validity
169 </dd>
170 </dl>
171 <dl>
172 <dt>Return Type:</dt>
173 <dd>
174 tuple of (str, bool)
175 </dd>
176 </dl>
177 <a NAME="MicrosoftEngine.__mapLanguageCode" ID="MicrosoftEngine.__mapLanguageCode"></a>
178 <h4>MicrosoftEngine.__mapLanguageCode</h4>
179 <b>__mapLanguageCode</b>(<i>code</i>)
180
181 <p>
182 Private method to map a language code to the Microsoft code.
183 </p>
184 <dl>
185
186 <dt><i>code</i></dt>
187 <dd>
188 language code (string)
189 </dd>
190 </dl>
191 <dl>
192 <dt>Return:</dt>
193 <dd>
194 mapped language code (string)
195 </dd>
196 </dl>
197 <a NAME="MicrosoftEngine.engineName" ID="MicrosoftEngine.engineName"></a>
198 <h4>MicrosoftEngine.engineName</h4>
199 <b>engineName</b>(<i></i>)
200
201 <p>
202 Public method to return the name of the engine.
203 </p>
204 <dl>
205 <dt>Return:</dt>
206 <dd>
207 engine name (string)
208 </dd>
209 </dl>
210 <a NAME="MicrosoftEngine.getTextToSpeechData" ID="MicrosoftEngine.getTextToSpeechData"></a>
211 <h4>MicrosoftEngine.getTextToSpeechData</h4>
212 <b>getTextToSpeechData</b>(<i>requestObject, text, language</i>)
213
214 <p>
215 Public method to pronounce the given text.
216 </p>
217 <dl>
218
219 <dt><i>requestObject</i></dt>
220 <dd>
221 reference to the request object
222 (TranslatorRequest)
223 </dd>
224 <dt><i>text</i></dt>
225 <dd>
226 text to be pronounced (string)
227 </dd>
228 <dt><i>language</i></dt>
229 <dd>
230 language code of the text (string)
231 </dd>
232 </dl>
233 <dl>
234 <dt>Return:</dt>
235 <dd>
236 tuple with pronounce data (QByteArray) or error string (string)
237 and success flag (boolean)
238 </dd>
239 </dl>
240 <a NAME="MicrosoftEngine.getTranslation" ID="MicrosoftEngine.getTranslation"></a>
241 <h4>MicrosoftEngine.getTranslation</h4>
242 <b>getTranslation</b>(<i>requestObject, text, originalLanguage, translationLanguage</i>)
243
244 <p>
245 Public method to translate the given text.
246 </p>
247 <dl>
248
249 <dt><i>requestObject</i></dt>
250 <dd>
251 reference to the request object
252 (TranslatorRequest)
253 </dd>
254 <dt><i>text</i></dt>
255 <dd>
256 text to be translated (string)
257 </dd>
258 <dt><i>originalLanguage</i></dt>
259 <dd>
260 language code of the original (string)
261 </dd>
262 <dt><i>translationLanguage</i></dt>
263 <dd>
264 language code of the translation (string)
265 </dd>
266 </dl>
267 <dl>
268 <dt>Return:</dt>
269 <dd>
270 tuple of translated text (string) and flag indicating
271 success (boolean)
272 </dd>
273 </dl>
274 <a NAME="MicrosoftEngine.hasTTS" ID="MicrosoftEngine.hasTTS"></a>
275 <h4>MicrosoftEngine.hasTTS</h4>
276 <b>hasTTS</b>(<i></i>)
277
278 <p>
279 Public method indicating the Text-to-Speech capability.
280 </p>
281 <dl>
282 <dt>Return:</dt>
283 <dd>
284 flag indicating the Text-to-Speech capability (boolean)
285 </dd>
286 </dl>
287 <a NAME="MicrosoftEngine.supportedLanguages" ID="MicrosoftEngine.supportedLanguages"></a>
288 <h4>MicrosoftEngine.supportedLanguages</h4>
289 <b>supportedLanguages</b>(<i></i>)
290
291 <p>
292 Public method to get the supported languages.
293 </p>
294 <dl>
295 <dt>Return:</dt>
296 <dd>
297 list of supported language codes (list of string)
298 </dd>
299 </dl>
300 <div align="right"><a href="#top">Up</a></div>
301 <hr />
302 </body></html>

eric ide

mercurial