eric7/Plugins/UiExtensionPlugins/Translator/TranslatorLanguagesDb.py

branch
eric7
changeset 9148
b31f0d894b55
parent 9145
520a70c5437f
equal deleted inserted replaced
9147:bbf3af40c223 9148:b31f0d894b55
20 """ 20 """
21 def __init__(self, parent=None): 21 def __init__(self, parent=None):
22 """ 22 """
23 Constructor 23 Constructor
24 24
25 @param parent reference to the parent object (QObject) 25 @param parent reference to the parent object
26 @type QObject
26 """ 27 """
27 super().__init__(parent) 28 super().__init__(parent)
28 29
29 self.__languages = { 30 self.__languages = {
30 "af": self.tr("Afrikaans"), 31 "af": self.tr("Afrikaans"),
136 137
137 def getLanguageIcon(self, code): 138 def getLanguageIcon(self, code):
138 """ 139 """
139 Public method to get a language icon. 140 Public method to get a language icon.
140 141
141 @param code language code (string) 142 @param code language code
142 @return language icon (QIcon) 143 @type str
144 @return language icon
145 @rtype QIcon
143 """ 146 """
144 return UI.PixmapCache.getIcon(os.path.join( 147 return UI.PixmapCache.getIcon(os.path.join(
145 os.path.dirname(__file__), "icons", "flags", 148 os.path.dirname(__file__), "icons", "flags",
146 "{0}".format(code))) 149 "{0}".format(code)))
147 150
148 def getLanguage(self, code): 151 def getLanguage(self, code):
149 """ 152 """
150 Public method to get a translated language. 153 Public method to get a translated language.
151 154
152 @param code language code (string) 155 @param code language code
153 @return translated language (string) 156 @type str
157 @return translated language
158 @rtype str
154 """ 159 """
155 try: 160 try:
156 return self.__languages[code] 161 return self.__languages[code]
157 except KeyError: 162 except KeyError:
158 return "" 163 return ""
159 164
160 def getAllLanguages(self): 165 def getAllLanguages(self):
161 """ 166 """
162 Public method to get a list of the supported language codes. 167 Public method to get a list of the supported language codes.
163 168
164 @return list of supported language codes (list of string) 169 @return list of supported language codes
170 @rtype list of str
165 """ 171 """
166 return list(self.__languages.keys()) 172 return list(self.__languages.keys())
167 173
168 def convertTwoToThree(self, code): 174 def convertTwoToThree(self, code):
169 """ 175 """
170 Public method to convert a two character language code to a 176 Public method to convert a two character language code to a
171 thre character code. 177 thre character code.
172 178
173 @param code two character language code (string) 179 @param code two character language code
174 @return three character language code (string) 180 @type str
181 @return three character language code
182 @rtype str
175 """ 183 """
176 try: 184 try:
177 return self.__toThreeCharacterCode[code] 185 return self.__toThreeCharacterCode[code]
178 except KeyError: 186 except KeyError:
179 return "" 187 return ""

eric ide

mercurial