21 """ |
21 """ |
22 Module function to get the list of supported translation engines. |
22 Module function to get the list of supported translation engines. |
23 |
23 |
24 @return names of supported engines (list of string) |
24 @return names of supported engines (list of string) |
25 """ |
25 """ |
26 # TODO: port deepl to use the commercial API |
|
27 ## return ["googlev1", "mymemory", "glosbe", "promt", "yandex", "googlev2", |
|
28 ## "microsoft", "deepl", "ibm_watson"] |
|
29 return ["googlev1", "mymemory", "glosbe", "promt", "yandex", "googlev2", |
26 return ["googlev1", "mymemory", "glosbe", "promt", "yandex", "googlev2", |
30 "microsoft", "ibm_watson"] |
27 "microsoft", "deepl", "ibm_watson"] |
31 |
28 |
32 |
29 |
33 def engineDisplayName(name): |
30 def engineDisplayName(name): |
34 """ |
31 """ |
35 Module function to get a translated name for an engine. |
32 Module function to get a translated name for an engine. |
49 return QCoreApplication.translate("TranslatorEngines", "Yandex") |
46 return QCoreApplication.translate("TranslatorEngines", "Yandex") |
50 elif name == "googlev2": |
47 elif name == "googlev2": |
51 return QCoreApplication.translate("TranslatorEngines", "Google V.2") |
48 return QCoreApplication.translate("TranslatorEngines", "Google V.2") |
52 elif name == "microsoft": |
49 elif name == "microsoft": |
53 return QCoreApplication.translate("TranslatorEngines", "Microsoft") |
50 return QCoreApplication.translate("TranslatorEngines", "Microsoft") |
54 ## elif name == "deepl": |
51 elif name == "deepl": |
55 ## return QCoreApplication.translate("TranslatorEngines", "DeepL") |
52 return QCoreApplication.translate("TranslatorEngines", "DeepL Pro") |
56 elif name == "ibm_watson": |
53 elif name == "ibm_watson": |
57 return QCoreApplication.translate("TranslatorEngines", "IBM Watson") |
54 return QCoreApplication.translate("TranslatorEngines", "IBM Watson") |
58 else: |
55 else: |
59 return QCoreApplication.translate( |
56 return QCoreApplication.translate( |
60 "TranslatorEngines", "Unknow translation service name ({0})")\ |
57 "TranslatorEngines", "Unknow translation service name ({0})")\ |
89 from .GoogleV2Engine import GoogleV2Engine |
86 from .GoogleV2Engine import GoogleV2Engine |
90 engine = GoogleV2Engine(plugin, parent) |
87 engine = GoogleV2Engine(plugin, parent) |
91 elif name == "microsoft": |
88 elif name == "microsoft": |
92 from .MicrosoftEngine import MicrosoftEngine |
89 from .MicrosoftEngine import MicrosoftEngine |
93 engine = MicrosoftEngine(plugin, parent) |
90 engine = MicrosoftEngine(plugin, parent) |
94 ## elif name == "deepl": |
91 elif name == "deepl": |
95 ## from .DeepLEngine import DeepLEngine |
92 from .DeepLEngine import DeepLEngine |
96 ## engine = DeepLEngine(plugin, parent) |
93 engine = DeepLEngine(plugin, parent) |
97 elif name == "ibm_watson": |
94 elif name == "ibm_watson": |
98 from .IbmWatsonEngine import IbmWatsonEngine |
95 from .IbmWatsonEngine import IbmWatsonEngine |
99 engine = IbmWatsonEngine(plugin, parent) |
96 engine = IbmWatsonEngine(plugin, parent) |
100 else: |
97 else: |
101 engine = None |
98 engine = None |
124 Module function to get an URL to request a user key. |
121 Module function to get an URL to request a user key. |
125 |
122 |
126 @param name name of the online translation service (string) |
123 @param name name of the online translation service (string) |
127 @return key request URL (string) |
124 @return key request URL (string) |
128 """ |
125 """ |
129 # TODO: get URL for deepl |
|
130 if name == "mymemory": |
126 if name == "mymemory": |
131 return "http://mymemory.translated.net/doc/keygen.php" |
127 return "http://mymemory.translated.net/doc/keygen.php" |
132 elif name == "yandex": |
128 elif name == "yandex": |
133 return "http://api.yandex.com/key/form.xml?service=trnsl" |
129 return "http://api.yandex.com/key/form.xml?service=trnsl" |
134 elif name == "googlev2": |
130 elif name == "googlev2": |
135 return "https://console.developers.google.com/" |
131 return "https://console.developers.google.com/" |
136 elif name == "microsoft": |
132 elif name == "microsoft": |
137 return "https://portal.azure.com" |
133 return "https://portal.azure.com" |
138 elif name == "ibm_watson": |
134 elif name == "ibm_watson": |
139 return "https://www.ibm.com/watson/services/language-translator/" |
135 return "https://www.ibm.com/watson/services/language-translator/" |
|
136 elif name == "deepl": |
|
137 return "https://www.deepl.com/pro-registration.html" |
140 else: |
138 else: |
141 return "" |
139 return "" |