Fix bug if no lanuagage files

This commit is contained in:
Tim Bentley 2010-09-20 05:59:51 +01:00
parent 551bf3c41f
commit b73a921dbc

View File

@ -107,19 +107,20 @@ class LanguageManager(object):
``action`` ``action``
The language menu option The language menu option
""" """
action_name = u'%s' % action.objectName() if action:
qm_list = LanguageManager.get_qm_list() action_name = u'%s' % action.objectName()
if LanguageManager.auto_language: qm_list = LanguageManager.get_qm_list()
language = u'[%s]' % qm_list[action_name] if LanguageManager.auto_language:
else: language = u'[%s]' % qm_list[action_name]
language = u'%s' % qm_list[action_name] else:
QtCore.QSettings().setValue( language = u'%s' % qm_list[action_name]
u'general/language', QtCore.QVariant(language)) QtCore.QSettings().setValue(
log.info(u'Language file: \'%s\' written to conf file' % language) u'general/language', QtCore.QVariant(language))
QtGui.QMessageBox.information(None, log.info(u'Language file: \'%s\' written to conf file' % language)
translate('OpenLP.LanguageManager', 'Language'), QtGui.QMessageBox.information(None,
translate('OpenLP.LanguageManager', translate('OpenLP.LanguageManager', 'Language'),
'Please restart OpenLP to use your new language setting.')) translate('OpenLP.LanguageManager',
'Please restart OpenLP to use your new language setting.'))
@staticmethod @staticmethod
def init_qm_list(): def init_qm_list():