Moved the translation files to their proper place on Linux/BSD/*nix.

This commit is contained in:
Raoul Snyman 2011-03-12 01:41:44 +02:00
parent 4ad32acc82
commit 192a3de2ad
4 changed files with 29 additions and 16 deletions

View File

@ -35,6 +35,7 @@ import urllib2
from datetime import datetime
from PyQt4 import QtGui, QtCore
if sys.platform != u'win32' and sys.platform != u'darwin':
try:
from xdg import BaseDirectory
@ -134,7 +135,7 @@ class AppLocation(object):
elif dir_type == AppLocation.LanguageDir:
app_path = _get_frozen_path(
os.path.abspath(os.path.split(sys.argv[0])[0]),
os.path.split(openlp.__file__)[0])
_get_os_dir_path(dir_type))
return os.path.join(app_path, u'i18n')
else:
return _get_os_dir_path(dir_type)
@ -169,15 +170,21 @@ def _get_os_dir_path(dir_type):
if dir_type == AppLocation.DataDir:
return os.path.join(unicode(os.getenv(u'APPDATA'), encoding),
u'openlp', u'data')
elif dir_type == AppLocation.LanguageDir:
return os.path.split(openlp.__file__)[0]
return os.path.join(unicode(os.getenv(u'APPDATA'), encoding),
u'openlp')
elif sys.platform == u'darwin':
if dir_type == AppLocation.DataDir:
return os.path.join(unicode(os.getenv(u'HOME'), encoding),
u'Library', u'Application Support', u'openlp', u'Data')
elif dir_type == AppLocation.LanguageDir:
return os.path.split(openlp.__file__)[0]
return os.path.join(unicode(os.getenv(u'HOME'), encoding),
u'Library', u'Application Support', u'openlp')
else:
if dir_type == AppLocation.LanguageDir:
return os.path.join(u'/usr', u'share', u'openlp')
if XDG_BASE_AVAILABLE:
if dir_type == AppLocation.ConfigDir:
return os.path.join(unicode(BaseDirectory.xdg_config_home,

View File

@ -63,6 +63,8 @@ class LanguageManager(object):
"""
Find all available language files in this OpenLP install
"""
log.debug(u'Translation files: %s', AppLocation.get_directory(
AppLocation.LanguageDir))
trans_dir = QtCore.QDir(AppLocation.get_directory(
AppLocation.LanguageDir))
file_names = trans_dir.entryList(QtCore.QStringList(u'*.qm'),

View File

@ -2,12 +2,16 @@
# -*- makefile -*-
build:
mkdir -p openlp/i18n
mkdir -p resources/i18n/qm
for TSFILE in resources/i18n/*.ts; do\
lrelease-qt4 $$TSFILE -qm openlp/i18n/`basename $$TSFILE .ts`.qm;\
lrelease-qt4 $$TSFILE -qm resources/i18n/qm/`basename $$TSFILE .ts`.qm;\
done
install:
mkdir -p $(DESTDIR)/usr/share/openlp/i18n
cd resources/i18n/qm && for QMFILE in*.qm; do\
mv $QMFILE $(DESTDIR)/usr/share/openlp/i18n;\
done
clean:
rm -fR resources/i18n/qm

View File

@ -2,8 +2,8 @@
DEB_PYTHON_SYSTEM := pysupport
DEB_MAKE_BUILD_TARGET := build
DEB_MAKE_INSTALL_TARGET :=
DEB_MAKE_CLEAN_TARGET :=
DEB_MAKE_INSTALL_TARGET := install
DEB_MAKE_CLEAN_TARGET := clean
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk