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 return ["googlev1", "mymemory", "glosbe", "promt", "yandex", "googlev2", |
26 return ["googlev1", "mymemory", "glosbe", "promt", "yandex", "googlev2", |
27 "microsoft", "deepl"] |
27 "microsoft", "deepl", "ibm_watson"] |
28 |
28 |
29 |
29 |
30 def engineDisplayName(name): |
30 def engineDisplayName(name): |
31 """ |
31 """ |
32 Module function to get a translated name for an engine. |
32 Module function to get a translated name for an engine. |
48 return QCoreApplication.translate("TranslatorEngines", "Google V.2") |
48 return QCoreApplication.translate("TranslatorEngines", "Google V.2") |
49 elif name == "microsoft": |
49 elif name == "microsoft": |
50 return QCoreApplication.translate("TranslatorEngines", "Microsoft") |
50 return QCoreApplication.translate("TranslatorEngines", "Microsoft") |
51 elif name == "deepl": |
51 elif name == "deepl": |
52 return QCoreApplication.translate("TranslatorEngines", "DeepL") |
52 return QCoreApplication.translate("TranslatorEngines", "DeepL") |
|
53 elif name == "ibm_watson": |
|
54 return QCoreApplication.translate("TranslatorEngines", "IBM Watson") |
53 else: |
55 else: |
54 return QCoreApplication.translate( |
56 return QCoreApplication.translate( |
55 "TranslatorEngines", "Unknow translation service name ({0})")\ |
57 "TranslatorEngines", "Unknow translation service name ({0})")\ |
56 .format(name) |
58 .format(name) |
57 |
59 |
87 from .MicrosoftEngine import MicrosoftEngine |
89 from .MicrosoftEngine import MicrosoftEngine |
88 engine = MicrosoftEngine(plugin, parent) |
90 engine = MicrosoftEngine(plugin, parent) |
89 elif name == "deepl": |
91 elif name == "deepl": |
90 from .DeepLEngine import DeepLEngine |
92 from .DeepLEngine import DeepLEngine |
91 engine = DeepLEngine(plugin, parent) |
93 engine = DeepLEngine(plugin, parent) |
|
94 elif name == "ibm_watson": |
|
95 from .IbmWatsonEngine import IbmWatsonEngine |
|
96 engine = IbmWatsonEngine(plugin, parent) |
92 else: |
97 else: |
93 engine = None |
98 engine = None |
94 return engine |
99 return engine |
95 |
100 |
96 |
101 |
124 return "http://api.yandex.com/key/form.xml?service=trnsl" |
129 return "http://api.yandex.com/key/form.xml?service=trnsl" |
125 elif name == "googlev2": |
130 elif name == "googlev2": |
126 return "https://console.developers.google.com/" |
131 return "https://console.developers.google.com/" |
127 elif name == "microsoft": |
132 elif name == "microsoft": |
128 return "https://portal.azure.com" |
133 return "https://portal.azure.com" |
|
134 elif name == "ibm_watson": |
|
135 return "https://www.ibm.com/watson/services/language-translator/" |
129 else: |
136 else: |
130 return "" |
137 return "" |