- fixed standard buttons (Cancel, OK, ...) and standard menu entries (Copy, Cut, Paste, ...) not being translated

bzr-revno: 1512
This commit is contained in:
Andreas Preikschat 2011-05-03 07:14:16 +02:00
commit 8643f4b317
2 changed files with 17 additions and 4 deletions

View File

@ -241,8 +241,14 @@ def main():
+ "/qt4_plugins")
# i18n Set Language
language = LanguageManager.get_language()
appTranslator = LanguageManager.get_translator(language)
app.installTranslator(appTranslator)
app_translator, default_translator = \
LanguageManager.get_translator(language)
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())

View File

@ -28,6 +28,7 @@ The :mod:`languagemanager` module provides all the translation settings and
language file loading for OpenLP.
"""
import logging
import sys
from PyQt4 import QtCore, QtGui
@ -55,8 +56,14 @@ class LanguageManager(object):
language = QtCore.QLocale.system().name()
lang_path = AppLocation.get_directory(AppLocation.LanguageDir)
app_translator = QtCore.QTranslator()
if app_translator.load(language, lang_path):
return app_translator
app_translator.load(language, lang_path)
# A translator for buttons and other default strings provided by Qt.
if sys.platform != u'win32' and sys.platform != u'darwin':
lang_path = QtCore.QLibraryInfo.location(
QtCore.QLibraryInfo.TranslationsPath)
default_translator = QtCore.QTranslator()
default_translator.load(u'qt_%s' % language, lang_path)
return app_translator, default_translator
@staticmethod
def find_qm_files():