Lanugages now work

This commit is contained in:
Tim Bentley 2010-09-12 10:14:02 +01:00
commit 37aecbefaf
2 changed files with 7 additions and 3 deletions

View File

@ -112,7 +112,11 @@ class AppLocation(object):
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')

View File

@ -55,7 +55,7 @@ class LanguageManager(object):
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 @@ class LanguageManager(object):
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: