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