forked from openlp/openlp
Fix code so translations can be found
bzr-revno: 1029
This commit is contained in:
commit
317a4ea8c6
@ -112,7 +112,11 @@ class AppLocation(object):
|
|||||||
The directory type you want, for instance the data directory.
|
The directory type you want, for instance the data directory.
|
||||||
"""
|
"""
|
||||||
if dir_type == AppLocation.AppDir:
|
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:
|
elif dir_type == AppLocation.ConfigDir:
|
||||||
if sys.platform == u'win32':
|
if sys.platform == u'win32':
|
||||||
path = os.path.join(os.getenv(u'APPDATA'), u'openlp')
|
path = os.path.join(os.getenv(u'APPDATA'), u'openlp')
|
||||||
|
@ -55,7 +55,7 @@ class LanguageManager(object):
|
|||||||
if LanguageManager.AutoLanguage:
|
if LanguageManager.AutoLanguage:
|
||||||
language = QtCore.QLocale.system().name()
|
language = QtCore.QLocale.system().name()
|
||||||
lang_path = AppLocation.get_directory(AppLocation.AppDir)
|
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()
|
app_translator = QtCore.QTranslator()
|
||||||
if app_translator.load("openlp_" + language, lang_path):
|
if app_translator.load("openlp_" + language, lang_path):
|
||||||
return app_translator
|
return app_translator
|
||||||
@ -66,7 +66,7 @@ class LanguageManager(object):
|
|||||||
Find all available language files in this OpenLP install
|
Find all available language files in this OpenLP install
|
||||||
"""
|
"""
|
||||||
trans_dir = AppLocation.get_directory(AppLocation.AppDir)
|
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"),
|
file_names = trans_dir.entryList(QtCore.QStringList("*.qm"),
|
||||||
QtCore.QDir.Files, QtCore.QDir.Name)
|
QtCore.QDir.Files, QtCore.QDir.Name)
|
||||||
for name in file_names:
|
for name in file_names:
|
||||||
|
Loading…
Reference in New Issue
Block a user