|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.MicrosoftEngine</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.Plugins.UiExtensionPlugins.Translator.TranslatorEngines.MicrosoftEngine</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing the Microsoft translation engine. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#MicrosoftEngine">MicrosoftEngine</a></td> |
|
25 <td>Class implementing the translation engine for the Microsoft translation service.</td> |
|
26 </tr> |
|
27 </table> |
|
28 <h3>Functions</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <hr /> |
|
34 <hr /> |
|
35 <a NAME="MicrosoftEngine" ID="MicrosoftEngine"></a> |
|
36 <h2>MicrosoftEngine</h2> |
|
37 |
|
38 <p> |
|
39 Class implementing the translation engine for the Microsoft |
|
40 translation service. |
|
41 </p> |
|
42 <h3>Derived from</h3> |
|
43 TranslationEngine |
|
44 <h3>Class Attributes</h3> |
|
45 |
|
46 <table> |
|
47 <tr><td>TranslatorUrl</td></tr> |
|
48 </table> |
|
49 <h3>Class Methods</h3> |
|
50 |
|
51 <table> |
|
52 <tr><td>None</td></tr> |
|
53 </table> |
|
54 <h3>Methods</h3> |
|
55 |
|
56 <table> |
|
57 |
|
58 <tr> |
|
59 <td><a href="#MicrosoftEngine.__init__">MicrosoftEngine</a></td> |
|
60 <td>Constructor</td> |
|
61 </tr> |
|
62 <tr> |
|
63 <td><a href="#MicrosoftEngine.__getClientDataAzure">__getClientDataAzure</a></td> |
|
64 <td>Private method to retrieve the client data.</td> |
|
65 </tr> |
|
66 <tr> |
|
67 <td><a href="#MicrosoftEngine.__mapLanguageCode">__mapLanguageCode</a></td> |
|
68 <td>Private method to map a language code to the Microsoft code.</td> |
|
69 </tr> |
|
70 <tr> |
|
71 <td><a href="#MicrosoftEngine.engineName">engineName</a></td> |
|
72 <td>Public method to return the name of the engine.</td> |
|
73 </tr> |
|
74 <tr> |
|
75 <td><a href="#MicrosoftEngine.getTranslation">getTranslation</a></td> |
|
76 <td>Public method to translate the given text.</td> |
|
77 </tr> |
|
78 <tr> |
|
79 <td><a href="#MicrosoftEngine.supportedLanguages">supportedLanguages</a></td> |
|
80 <td>Public method to get the supported languages.</td> |
|
81 </tr> |
|
82 </table> |
|
83 <h3>Static Methods</h3> |
|
84 |
|
85 <table> |
|
86 <tr><td>None</td></tr> |
|
87 </table> |
|
88 |
|
89 <a NAME="MicrosoftEngine.__init__" ID="MicrosoftEngine.__init__"></a> |
|
90 <h4>MicrosoftEngine (Constructor)</h4> |
|
91 <b>MicrosoftEngine</b>(<i>plugin, parent=None</i>) |
|
92 |
|
93 <p> |
|
94 Constructor |
|
95 </p> |
|
96 <dl> |
|
97 |
|
98 <dt><i>plugin</i> (TranslatorPlugin)</dt> |
|
99 <dd> |
|
100 reference to the plugin object |
|
101 </dd> |
|
102 <dt><i>parent</i> (QObject)</dt> |
|
103 <dd> |
|
104 reference to the parent object |
|
105 </dd> |
|
106 </dl> |
|
107 <a NAME="MicrosoftEngine.__getClientDataAzure" ID="MicrosoftEngine.__getClientDataAzure"></a> |
|
108 <h4>MicrosoftEngine.__getClientDataAzure</h4> |
|
109 <b>__getClientDataAzure</b>(<i></i>) |
|
110 |
|
111 <p> |
|
112 Private method to retrieve the client data. |
|
113 </p> |
|
114 <dl> |
|
115 <dt>Return:</dt> |
|
116 <dd> |
|
117 tuple giving the API subscription key, the API subscription |
|
118 region and a flag indicating validity |
|
119 </dd> |
|
120 </dl> |
|
121 <dl> |
|
122 <dt>Return Type:</dt> |
|
123 <dd> |
|
124 tuple of (str, str, bool) |
|
125 </dd> |
|
126 </dl> |
|
127 <a NAME="MicrosoftEngine.__mapLanguageCode" ID="MicrosoftEngine.__mapLanguageCode"></a> |
|
128 <h4>MicrosoftEngine.__mapLanguageCode</h4> |
|
129 <b>__mapLanguageCode</b>(<i>code</i>) |
|
130 |
|
131 <p> |
|
132 Private method to map a language code to the Microsoft code. |
|
133 </p> |
|
134 <dl> |
|
135 |
|
136 <dt><i>code</i> (str)</dt> |
|
137 <dd> |
|
138 language code |
|
139 </dd> |
|
140 </dl> |
|
141 <dl> |
|
142 <dt>Return:</dt> |
|
143 <dd> |
|
144 mapped language code |
|
145 </dd> |
|
146 </dl> |
|
147 <dl> |
|
148 <dt>Return Type:</dt> |
|
149 <dd> |
|
150 str |
|
151 </dd> |
|
152 </dl> |
|
153 <a NAME="MicrosoftEngine.engineName" ID="MicrosoftEngine.engineName"></a> |
|
154 <h4>MicrosoftEngine.engineName</h4> |
|
155 <b>engineName</b>(<i></i>) |
|
156 |
|
157 <p> |
|
158 Public method to return the name of the engine. |
|
159 </p> |
|
160 <dl> |
|
161 <dt>Return:</dt> |
|
162 <dd> |
|
163 engine name |
|
164 </dd> |
|
165 </dl> |
|
166 <dl> |
|
167 <dt>Return Type:</dt> |
|
168 <dd> |
|
169 str |
|
170 </dd> |
|
171 </dl> |
|
172 <a NAME="MicrosoftEngine.getTranslation" ID="MicrosoftEngine.getTranslation"></a> |
|
173 <h4>MicrosoftEngine.getTranslation</h4> |
|
174 <b>getTranslation</b>(<i>requestObject, text, originalLanguage, translationLanguage</i>) |
|
175 |
|
176 <p> |
|
177 Public method to translate the given text. |
|
178 </p> |
|
179 <dl> |
|
180 |
|
181 <dt><i>requestObject</i> (TranslatorRequest)</dt> |
|
182 <dd> |
|
183 reference to the request object |
|
184 </dd> |
|
185 <dt><i>text</i> (str)</dt> |
|
186 <dd> |
|
187 text to be translated |
|
188 </dd> |
|
189 <dt><i>originalLanguage</i> (str)</dt> |
|
190 <dd> |
|
191 language code of the original |
|
192 </dd> |
|
193 <dt><i>translationLanguage</i> (str)</dt> |
|
194 <dd> |
|
195 language code of the translation |
|
196 </dd> |
|
197 </dl> |
|
198 <dl> |
|
199 <dt>Return:</dt> |
|
200 <dd> |
|
201 tuple of translated text and flag indicating success |
|
202 </dd> |
|
203 </dl> |
|
204 <dl> |
|
205 <dt>Return Type:</dt> |
|
206 <dd> |
|
207 tuple of (str, bool) |
|
208 </dd> |
|
209 </dl> |
|
210 <a NAME="MicrosoftEngine.supportedLanguages" ID="MicrosoftEngine.supportedLanguages"></a> |
|
211 <h4>MicrosoftEngine.supportedLanguages</h4> |
|
212 <b>supportedLanguages</b>(<i></i>) |
|
213 |
|
214 <p> |
|
215 Public method to get the supported languages. |
|
216 </p> |
|
217 <dl> |
|
218 <dt>Return:</dt> |
|
219 <dd> |
|
220 list of supported language codes |
|
221 </dd> |
|
222 </dl> |
|
223 <dl> |
|
224 <dt>Return Type:</dt> |
|
225 <dd> |
|
226 list of str |
|
227 </dd> |
|
228 </dl> |
|
229 <div align="right"><a href="#top">Up</a></div> |
|
230 <hr /> |
|
231 </body></html> |