Rewrited languagebox module a bit
This commit is contained in:
parent
825ac4da00
commit
0bd1fe5a9c
|
@ -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)
|
||||
|
|
Reference in New Issue
Block a user