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") + "/qt4_plugins")
# i18n Set Language # i18n Set Language
language = LanguageManager.get_language() language = LanguageManager.get_language()
appTranslator, default_string_translator = \ app_translator, default_translator = \
LanguageManager.get_translator(language) LanguageManager.get_translator(language)
app.installTranslator(appTranslator) if not app_translator.isEmpty():
app.installTranslator(default_string_translator) 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: if not options.no_error_form:
sys.excepthook = app.hookException sys.excepthook = app.hookException
sys.exit(app.run()) sys.exit(app.run())
@ -253,3 +257,4 @@ if __name__ == u'__main__':
Instantiate and run the application. Instantiate and run the application.
""" """
main() main()

View File

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