def configureLanguages(self,comboWidget,interfaceLanguage="en"): cw = comboWidget #Just cause its easier to refer to for lang in self.languages: langName = isoLangCodes.iso639CodeToString(lang) cw.addItem(langName,lang) if len(self.languages) == 0: #There are no languages, so we'll add the current interface language to make sure something is there. cw.addItem(interfaceLanguage) langIndex = self.languageList.findData(self.currentLanguage) self.languageList.setCurrentIndex(max(0,langIndex))
def addLanguage(self,lang): lang, success = languagePickerDialog() if lang is None or lang == "": return lang = str(lang) if success and lang not in self.languages: self.languageAdded.emit(lang) self.languages.append(lang) self.languages.sort() self.languageList.addItem(isoLangCodes.iso639CodeToString(lang),lang) if lang in self.languages: self.languageList.setCurrentIndex(self.languageList.findData(lang))