mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
fix Qt translations in macOS packaged build
This commit is contained in:
parent
3c1fa68460
commit
a602f0342c
2 changed files with 13 additions and 2 deletions
|
@ -222,6 +222,14 @@ def setupLangAndBackend(
|
||||||
|
|
||||||
# load qt translations
|
# load qt translations
|
||||||
_qtrans = QTranslator()
|
_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_dir = QLibraryInfo.location(QLibraryInfo.TranslationsPath)
|
||||||
qt_lang = lang.replace("-", "_")
|
qt_lang = lang.replace("-", "_")
|
||||||
if _qtrans.load("qtbase_" + qt_lang, qt_dir):
|
if _qtrans.load("qtbase_" + qt_lang, qt_dir):
|
||||||
|
|
|
@ -53,6 +53,9 @@ def aqt_data_folder() -> str:
|
||||||
if os.path.exists(dir):
|
if os.path.exists(dir):
|
||||||
return dir
|
return dir
|
||||||
# packaged install?
|
# packaged install?
|
||||||
|
if isMac:
|
||||||
|
dir2 = os.path.join(sys.prefix, "..", "Resources", "aqt_data")
|
||||||
|
else:
|
||||||
dir2 = os.path.join(sys.prefix, "aqt_data")
|
dir2 = os.path.join(sys.prefix, "aqt_data")
|
||||||
if os.path.exists(dir2):
|
if os.path.exists(dir2):
|
||||||
return dir2
|
return dir2
|
||||||
|
|
Loading…
Reference in a new issue