diff --git a/openlp.pyw b/openlp.pyw index 393a1331b..c551636b8 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -276,8 +276,10 @@ def main(): if QtCore.QSettings().value( u'general/first time', QtCore.QVariant(True)).toBool(): FirstTimeForm().exec_() + pass # i18n Set Language language = LanguageManager.get_language() + print language appTranslator = LanguageManager.get_translator(language) app.installTranslator(appTranslator) if not options.no_error_form: diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 88220ed33..2a23350a6 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -69,6 +69,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): else: self.internetGroupBox.setVisible(False) self.noInternetLabel.setVisible(True) + if LanguageManager.auto_language: + self.LanguageComboBox.setEnabled(False) self.qmList = LanguageManager.get_qm_list() for key in sorted(self.qmList.keys()): self.LanguageComboBox.addItem(key) @@ -83,8 +85,14 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.__pluginStatus(self.customCheckBox, u'custom/status') self.__pluginStatus(self.songUsageCheckBox, u'songusage/status') self.__pluginStatus(self.alertCheckBox, u'alerts/status') - - print self.qmList[unicode(self.LanguageComboBox.currentText())] + if self.autoLanguageCheckBox.checkState() == QtCore.Qt.Checked: + LanguageManager.auto_language = True + LanguageManager.set_language(False, False) + else: + LanguageManager.auto_language = False + action = QtGui.QAction(None) + action.setObjectName(unicode(self.LanguageComboBox.currentText())) + LanguageManager.set_language(action, False) return QtGui.QWizard.accept(self) def __pluginStatus(self, field, tag): diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index 43d2a8e67..e90a659ec 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -99,16 +99,20 @@ class LanguageManager(object): return language @staticmethod - def set_language(action): + def set_language(action, message=True): """ Set the language to translate OpenLP into ``action`` The language menu option + + ``message`` + Display the message option """ language = u'en' if action: action_name = u'%s' % action.objectName() + print action_name qm_list = LanguageManager.get_qm_list() language = u'%s' % qm_list[action_name] if LanguageManager.auto_language: @@ -116,10 +120,11 @@ class LanguageManager(object): QtCore.QSettings().setValue( u'general/language', QtCore.QVariant(language)) log.info(u'Language file: \'%s\' written to conf file' % language) - QtGui.QMessageBox.information(None, - translate('OpenLP.LanguageManager', 'Language'), - translate('OpenLP.LanguageManager', - 'Please restart OpenLP to use your new language setting.')) + if message: + QtGui.QMessageBox.information(None, + translate('OpenLP.LanguageManager', 'Language'), + translate('OpenLP.LanguageManager', + 'Please restart OpenLP to use your new language setting.')) @staticmethod def init_qm_list(): diff --git a/resources/forms/firsttimewizard.ui b/resources/forms/firsttimewizard.ui index 305fd66a0..ec55bcd42 100644 --- a/resources/forms/firsttimewizard.ui +++ b/resources/forms/firsttimewizard.ui @@ -300,8 +300,8 @@ p, li { white-space: pre-wrap; } 20 20 - 252 - 88 + 491 + 113 @@ -339,15 +339,29 @@ p, li { white-space: pre-wrap; } - + Select default language - - + + + + QComboBox::AdjustToContents + + + + + + + Auto Language + + + true + +