fix Qt translations in macOS packaged build

This commit is contained in:
Damien Elmes 2021-02-04 20:28:25 +10:00
parent 3c1fa68460
commit a602f0342c
2 changed files with 13 additions and 2 deletions

View file

@ -222,6 +222,14 @@ def setupLangAndBackend(
# load qt translations
_qtrans = QTranslator()
from aqt.utils import aqt_data_folder
if isMac and getattr(sys, "frozen", False):
qt_dir = os.path.abspath(
os.path.join(aqt_data_folder(), "..", "qt_translations")
)
else:
qt_dir = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
qt_lang = lang.replace("-", "_")
if _qtrans.load("qtbase_" + qt_lang, qt_dir):

View file

@ -53,6 +53,9 @@ def aqt_data_folder() -> str:
if os.path.exists(dir):
return dir
# packaged install?
if isMac:
dir2 = os.path.join(sys.prefix, "..", "Resources", "aqt_data")
else:
dir2 = os.path.join(sys.prefix, "aqt_data")
if os.path.exists(dir2):
return dir2