diff --git a/src/bitmessageqt/languagebox.py b/src/bitmessageqt/languagebox.py index 6ce432bd..1b8d4942 100644 --- a/src/bitmessageqt/languagebox.py +++ b/src/bitmessageqt/languagebox.py @@ -22,12 +22,11 @@ class LanguageBox(QtWidgets.QComboBox): self.languages = [] self.clear() localesPath = os.path.join(paths.codePath(), 'translations') - configuredLocale = "system" try: configuredLocale = BMConfigParser().get( 'bitmessagesettings', 'userlocale', "system") except: - pass + configuredLocale = "system" self.addItem( _translate("settingsDialog", "System Settings", "system"), "system" @@ -39,14 +38,13 @@ class LanguageBox(QtWidgets.QComboBox): ): localeShort = \ os.path.split(translationFile)[1].split("_", 1)[1][:-3] - locale = QtCore.QLocale(localeShort) if localeShort in LanguageBox.languageName: self.addItem( LanguageBox.languageName[localeShort], localeShort) - elif locale.nativeLanguageName() == "": - self.addItem(localeShort, localeShort) else: - self.addItem(locale.nativeLanguageName(), localeShort) + locale = QtCore.QLocale(localeShort) + self.addItem( + locale.nativeLanguageName() or localeShort, localeShort) for i in range(self.count()): if self.itemData(i) == configuredLocale: self.setCurrentIndex(i)