eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/TranslationEngine.py

changeset 8240
93b8a353c4bf
parent 8218
7c09585bd960
equal deleted inserted replaced
8239:59a9a658618c 8240:93b8a353c4bf
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the translation engine base class. 7 Module implementing the translation engine base class.
8 """ 8 """
9
10 import contextlib
9 11
10 from PyQt5.QtCore import pyqtSignal, QObject 12 from PyQt5.QtCore import pyqtSignal, QObject
11 13
12 14
13 class TranslationEngine(QObject): 15 class TranslationEngine(QObject):
60 @type str 62 @type str
61 @return list of supported target languages for the given original 63 @return list of supported target languages for the given original
62 @rtype list of str 64 @rtype list of str
63 """ 65 """
64 targetLanguages = self.supportedLanguages()[:] 66 targetLanguages = self.supportedLanguages()[:]
65 try: 67 with contextlib.suppress(ValueError):
66 targetLanguages.remove(original) 68 targetLanguages.remove(original)
67 except ValueError:
68 # original is not in the list of target languages
69 pass
70 69
71 return targetLanguages 70 return targetLanguages
72 71
73 def hasTTS(self): 72 def hasTTS(self):
74 """ 73 """

eric ide

mercurial