log empty default_translator

This commit is contained in:
Andreas Preikschat 2011-04-23 17:15:01 +02:00
parent 5a54a82345
commit 2167a697dd
2 changed files with 12 additions and 7 deletions

View File

@ -240,10 +240,14 @@ def main():
+ "/qt4_plugins")
# i18n Set Language
language = LanguageManager.get_language()
appTranslator, default_string_translator = \
app_translator, default_translator = \
LanguageManager.get_translator(language)
app.installTranslator(appTranslator)
app.installTranslator(default_string_translator)
if not app_translator.isEmpty():
app.installTranslator(app_translator)
if not default_translator.isEmpty():
app.installTranslator(default_translator)
else:
log.debug(u'Could not find default_translator.')
if not options.no_error_form:
sys.excepthook = app.hookException
sys.exit(app.run())
@ -253,3 +257,4 @@ if __name__ == u'__main__':
Instantiate and run the application.
"""
main()

View File

@ -55,11 +55,11 @@ class LanguageManager(object):
language = QtCore.QLocale.system().name()
lang_path = AppLocation.get_directory(AppLocation.LanguageDir)
app_translator = QtCore.QTranslator()
if not app_translator.load(language, lang_path):
return
app_translator.load(language, lang_path)
# A translator for buttons and other default strings provided by Qt.
default_string_translator = QtCore.QTranslator()
if default_string_translator.load(u'qt_%s' % language, lang_path):
return app_translator, default_string_translator
default_string_translator.load(u'qt_%s' % language, lang_path)
return app_translator, default_string_translator
@staticmethod
def find_qm_files():