← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/bugfixes into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/bugfixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


Test deployed a weekly build to a Fedora VM with *.qm files in openlp/i18n directory.

Files not found due to directory location /usr/bin as the application location.  Code fixed to point back to correct place under site packages.

Adjusted language path accordingly.

Tested on local box (this patch)

Deployed box (hand coded to get working).

Display openlp translated in foreign languages . 
-- 
https://code.launchpad.net/~trb143/openlp/bugfixes/+merge/35222
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/bugfixes into lp:openlp.
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py	2010-08-26 13:54:05 +0000
+++ openlp/core/utils/__init__.py	2010-09-12 09:19:45 +0000
@@ -112,7 +112,11 @@
             The directory type you want, for instance the data directory.
         """
         if dir_type == AppLocation.AppDir:
-            return os.path.abspath(os.path.split(sys.argv[0])[0])
+            if hasattr(sys, u'frozen') and sys.frozen == 1:
+               app_path = os.path.abspath(os.path.split(sys.argv[0])[0])
+            else:
+                app_path = os.path.split(openlp.__file__)[0]
+            return app_path
         elif dir_type == AppLocation.ConfigDir:
             if sys.platform == u'win32':
                 path = os.path.join(os.getenv(u'APPDATA'), u'openlp')

=== modified file 'openlp/core/utils/languagemanager.py'
--- openlp/core/utils/languagemanager.py	2010-09-11 15:58:03 +0000
+++ openlp/core/utils/languagemanager.py	2010-09-12 09:19:45 +0000
@@ -55,7 +55,7 @@
         if LanguageManager.AutoLanguage:
             language = QtCore.QLocale.system().name()
         lang_path = AppLocation.get_directory(AppLocation.AppDir)
-        lang_path = os.path.join(lang_path, u'resources', u'i18n')
+        lang_path = os.path.join(lang_path, u'i18n')
         app_translator = QtCore.QTranslator()
         if app_translator.load("openlp_" + language, lang_path):
             return app_translator
@@ -66,7 +66,7 @@
         Find all available language files in this OpenLP install
         """
         trans_dir = AppLocation.get_directory(AppLocation.AppDir)
-        trans_dir = QtCore.QDir(os.path.join(trans_dir, u'openlp', u'i18n'))
+        trans_dir = QtCore.QDir(os.path.join(trans_dir, u'i18n'))
         file_names = trans_dir.entryList(QtCore.QStringList("*.qm"),
                 QtCore.QDir.Files, QtCore.QDir.Name)
         for name in file_names:


Follow ups