← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol-hush/openlp/fixes2 into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol-hush/openlp/fixes2 into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)
  Jonathan Corwin (j-corwin)
  Raoul Snyman (raoul-snyman)

For more details, see:
https://code.launchpad.net/~googol-hush/openlp/fixes2/+merge/59687

Hello,

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

Background information:
Qt provides translations of some strings for example for standard buttons (/usr/share/qt4/translations). These buttons are currently not translated. We have to create a second QTranslator [1].

[1] http://www.qtcentre.org/threads/16714-QDialogButtonBox-translation-of-standard-button-text-%28-quot-OK-quot-quot-Cancel-quot-etc.%29?p=84102#post84102
-- 
https://code.launchpad.net/~googol-hush/openlp/fixes2/+merge/59687
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp.pyw'
--- openlp.pyw	2011-04-30 07:42:20 +0000
+++ openlp.pyw	2011-05-02 18:32:39 +0000
@@ -241,8 +241,14 @@
             + "/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())

=== modified file 'openlp/core/utils/languagemanager.py'
--- openlp/core/utils/languagemanager.py	2011-04-03 13:35:58 +0000
+++ openlp/core/utils/languagemanager.py	2011-05-02 18:32:39 +0000
@@ -28,6 +28,7 @@
 language file loading for OpenLP.
 """
 import logging
+import sys
 
 from PyQt4 import QtCore, QtGui
 
@@ -55,8 +56,14 @@
             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():


Follow ups