Now the userlocale can be set manually in the keys.dat without being overwritten (e.g. for importing language files that aren't already in the main code).

This commit is contained in:
sendiulo 2013-08-24 09:21:59 +02:00
parent da93d1d8b4
commit a36c696f9d
3 changed files with 16 additions and 5 deletions

View File

@ -2033,7 +2033,8 @@ class MyForm(QtGui.QMainWindow):
self.settingsDialogInstance.ui.checkBoxWillinglySendToMobile.isChecked())) self.settingsDialogInstance.ui.checkBoxWillinglySendToMobile.isChecked()))
lang_ind = int(self.settingsDialogInstance.ui.languageComboBox.currentIndex()) lang_ind = int(self.settingsDialogInstance.ui.languageComboBox.currentIndex())
shared.config.set('bitmessagesettings', 'userlocale', languages[lang_ind]) if not languages[lang_ind] == 'other':
shared.config.set('bitmessagesettings', 'userlocale', languages[lang_ind])
if int(shared.config.get('bitmessagesettings', 'port')) != int(self.settingsDialogInstance.ui.lineEditTCPPort.text()): if int(shared.config.get('bitmessagesettings', 'port')) != int(self.settingsDialogInstance.ui.lineEditTCPPort.text()):
if not shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'): if not shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'):
@ -3047,10 +3048,13 @@ class settingsDialog(QtGui.QDialog):
shared.safeConfigGetBoolean('bitmessagesettings', 'willinglysendtomobile')) shared.safeConfigGetBoolean('bitmessagesettings', 'willinglysendtomobile'))
global languages global languages
languages = ['system','en','eo','fr','de','es','ru','en_pirate'] languages = ['system','en','eo','fr','de','es','ru','en_pirate','other']
user_countrycode = str(shared.config.get('bitmessagesettings', 'userlocale')) user_countrycode = str(shared.config.get('bitmessagesettings', 'userlocale'))
self.ui.languageComboBox.setCurrentIndex(languages.index(user_countrycode)) if user_countrycode in languages:
curr_index = languages.index(user_countrycode)
else:
curr_index = languages.index('other')
self.ui.languageComboBox.setCurrentIndex(curr_index)
if shared.appdata == '': if shared.appdata == '':
self.ui.checkBoxPortableMode.setChecked(True) self.ui.checkBoxPortableMode.setChecked(True)

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'settings.ui' # Form implementation generated from reading ui file 'settings.ui'
# #
# Created: Sat Aug 24 08:28:46 2013 # Created: Sat Aug 24 09:19:58 2013
# by: PyQt4 UI code generator 4.10.2 # by: PyQt4 UI code generator 4.10.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -80,6 +80,7 @@ class Ui_settingsDialog(object):
self.languageComboBox.addItem(_fromUtf8("")) self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8("")) self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8("")) self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8(""))
self.horizontalLayout_2.addWidget(self.languageComboBox) self.horizontalLayout_2.addWidget(self.languageComboBox)
self.gridLayout_5.addWidget(self.groupBox, 10, 1, 1, 1) self.gridLayout_5.addWidget(self.groupBox, 10, 1, 1, 1)
self.tabWidgetSettings.addTab(self.tabUserInterface, _fromUtf8("")) self.tabWidgetSettings.addTab(self.tabUserInterface, _fromUtf8(""))
@ -351,6 +352,7 @@ class Ui_settingsDialog(object):
self.languageComboBox.setItemText(5, _translate("settingsDialog", "Spanish", "es")) self.languageComboBox.setItemText(5, _translate("settingsDialog", "Spanish", "es"))
self.languageComboBox.setItemText(6, _translate("settingsDialog", "Russian", "ru")) self.languageComboBox.setItemText(6, _translate("settingsDialog", "Russian", "ru"))
self.languageComboBox.setItemText(7, _translate("settingsDialog", "Pirate English", "en_pirate")) self.languageComboBox.setItemText(7, _translate("settingsDialog", "Pirate English", "en_pirate"))
self.languageComboBox.setItemText(8, _translate("settingsDialog", "Other (set in keys.dat)", "other"))
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabUserInterface), _translate("settingsDialog", "User Interface", None)) self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabUserInterface), _translate("settingsDialog", "User Interface", None))
self.groupBox1.setTitle(_translate("settingsDialog", "Listening port", None)) self.groupBox1.setTitle(_translate("settingsDialog", "Listening port", None))
self.label.setText(_translate("settingsDialog", "Listen for connections on port:", None)) self.label.setText(_translate("settingsDialog", "Listen for connections on port:", None))

View File

@ -153,6 +153,11 @@
<string comment="en_pirate">Pirate English</string> <string comment="en_pirate">Pirate English</string>
</property> </property>
</item> </item>
<item>
<property name="text">
<string comment="other">Other (set in keys.dat)</string>
</property>
</item>
</widget> </widget>
</item> </item>
</layout> </layout>