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"] |
26 return ["googlev1", "mymemory", "glosbe", "promt", "yandex", "googlev2", |
29 return ["googlev1", "mymemory", "glosbe", "promt", "yandex", "googlev2", |
27 "microsoft", "deepl", "ibm_watson"] |
30 "microsoft", "ibm_watson"] |
28 |
31 |
29 |
32 |
30 def engineDisplayName(name): |
33 def engineDisplayName(name): |
31 """ |
34 """ |
32 Module function to get a translated name for an engine. |
35 Module function to get a translated name for an engine. |
46 return QCoreApplication.translate("TranslatorEngines", "Yandex") |
49 return QCoreApplication.translate("TranslatorEngines", "Yandex") |
47 elif name == "googlev2": |
50 elif name == "googlev2": |
48 return QCoreApplication.translate("TranslatorEngines", "Google V.2") |
51 return QCoreApplication.translate("TranslatorEngines", "Google V.2") |
49 elif name == "microsoft": |
52 elif name == "microsoft": |
50 return QCoreApplication.translate("TranslatorEngines", "Microsoft") |
53 return QCoreApplication.translate("TranslatorEngines", "Microsoft") |
51 elif name == "deepl": |
54 ## elif name == "deepl": |
52 return QCoreApplication.translate("TranslatorEngines", "DeepL") |
55 ## return QCoreApplication.translate("TranslatorEngines", "DeepL") |
53 elif name == "ibm_watson": |
56 elif name == "ibm_watson": |
54 return QCoreApplication.translate("TranslatorEngines", "IBM Watson") |
57 return QCoreApplication.translate("TranslatorEngines", "IBM Watson") |
55 else: |
58 else: |
56 return QCoreApplication.translate( |
59 return QCoreApplication.translate( |
57 "TranslatorEngines", "Unknow translation service name ({0})")\ |
60 "TranslatorEngines", "Unknow translation service name ({0})")\ |
86 from .GoogleV2Engine import GoogleV2Engine |
89 from .GoogleV2Engine import GoogleV2Engine |
87 engine = GoogleV2Engine(plugin, parent) |
90 engine = GoogleV2Engine(plugin, parent) |
88 elif name == "microsoft": |
91 elif name == "microsoft": |
89 from .MicrosoftEngine import MicrosoftEngine |
92 from .MicrosoftEngine import MicrosoftEngine |
90 engine = MicrosoftEngine(plugin, parent) |
93 engine = MicrosoftEngine(plugin, parent) |
91 elif name == "deepl": |
94 ## elif name == "deepl": |
92 from .DeepLEngine import DeepLEngine |
95 ## from .DeepLEngine import DeepLEngine |
93 engine = DeepLEngine(plugin, parent) |
96 ## engine = DeepLEngine(plugin, parent) |
94 elif name == "ibm_watson": |
97 elif name == "ibm_watson": |
95 from .IbmWatsonEngine import IbmWatsonEngine |
98 from .IbmWatsonEngine import IbmWatsonEngine |
96 engine = IbmWatsonEngine(plugin, parent) |
99 engine = IbmWatsonEngine(plugin, parent) |
97 else: |
100 else: |
98 engine = None |
101 engine = None |
121 Module function to get an URL to request a user key. |
124 Module function to get an URL to request a user key. |
122 |
125 |
123 @param name name of the online translation service (string) |
126 @param name name of the online translation service (string) |
124 @return key request URL (string) |
127 @return key request URL (string) |
125 """ |
128 """ |
|
129 # TODO: get URL for deepl |
126 if name == "mymemory": |
130 if name == "mymemory": |
127 return "http://mymemory.translated.net/doc/keygen.php" |
131 return "http://mymemory.translated.net/doc/keygen.php" |
128 elif name == "yandex": |
132 elif name == "yandex": |
129 return "http://api.yandex.com/key/form.xml?service=trnsl" |
133 return "http://api.yandex.com/key/form.xml?service=trnsl" |
130 elif name == "googlev2": |
134 elif name == "googlev2": |