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.languages = []
|
||||||
self.clear()
|
self.clear()
|
||||||
localesPath = os.path.join(paths.codePath(), 'translations')
|
localesPath = os.path.join(paths.codePath(), 'translations')
|
||||||
configuredLocale = "system"
|
|
||||||
try:
|
try:
|
||||||
configuredLocale = BMConfigParser().get(
|
configuredLocale = BMConfigParser().get(
|
||||||
'bitmessagesettings', 'userlocale', "system")
|
'bitmessagesettings', 'userlocale', "system")
|
||||||
except:
|
except:
|
||||||
pass
|
configuredLocale = "system"
|
||||||
self.addItem(
|
self.addItem(
|
||||||
_translate("settingsDialog", "System Settings", "system"),
|
_translate("settingsDialog", "System Settings", "system"),
|
||||||
"system"
|
"system"
|
||||||
|
@ -39,14 +38,13 @@ class LanguageBox(QtWidgets.QComboBox):
|
||||||
):
|
):
|
||||||
localeShort = \
|
localeShort = \
|
||||||
os.path.split(translationFile)[1].split("_", 1)[1][:-3]
|
os.path.split(translationFile)[1].split("_", 1)[1][:-3]
|
||||||
locale = QtCore.QLocale(localeShort)
|
|
||||||
if localeShort in LanguageBox.languageName:
|
if localeShort in LanguageBox.languageName:
|
||||||
self.addItem(
|
self.addItem(
|
||||||
LanguageBox.languageName[localeShort], localeShort)
|
LanguageBox.languageName[localeShort], localeShort)
|
||||||
elif locale.nativeLanguageName() == "":
|
|
||||||
self.addItem(localeShort, localeShort)
|
|
||||||
else:
|
else:
|
||||||
self.addItem(locale.nativeLanguageName(), localeShort)
|
locale = QtCore.QLocale(localeShort)
|
||||||
|
self.addItem(
|
||||||
|
locale.nativeLanguageName() or localeShort, localeShort)
|
||||||
for i in range(self.count()):
|
for i in range(self.count()):
|
||||||
if self.itemData(i) == configuredLocale:
|
if self.itemData(i) == configuredLocale:
|
||||||
self.setCurrentIndex(i)
|
self.setCurrentIndex(i)
|
||||||
|
|
Reference in New Issue
Block a user