diff options
author | Andreas Bombe <aeb@debian.org> | 2024-03-04 14:36:39 +0000 |
---|---|---|
committer | Laurin Hagemann <laurinhg@gmx.de> | 2024-03-04 14:36:39 +0000 |
commit | 3cde3e66557c1dc65425e2bf731bceaa25c40991 (patch) | |
tree | bb80f2bd906f140b3c54f29f6beb3d82c0ceb5c4 | |
parent | 7326a66971d24ebc8a6b6a95b804e1ea2cb22fa0 (diff) |
Set file paths to the installed locations
Forwarded: not-needed
Currently the locale files are diverted from the upstream location, so the
directory for the gettext files is simply set to /usr/share/locale.
Gbp-Pq: Name paths
-rw-r--r-- | anki/lang.py | 14 | ||||
-rw-r--r-- | aqt/__init__.py | 2 |
2 files changed, 3 insertions, 13 deletions
diff --git a/anki/lang.py b/anki/lang.py index c0e97c2..3b601b2 100644 --- a/anki/lang.py +++ b/anki/lang.py @@ -2,7 +2,7 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -import os, sys, re +import re import gettext import threading @@ -79,17 +79,7 @@ def ngettext(single, plural, n): return localTranslation().ngettext(single, plural, n) def langDir(): - from anki.utils import isMac - filedir = os.path.dirname(os.path.abspath(__file__)) - if isMac: - dir = os.path.abspath(filedir + "/../../Resources/locale") - else: - dir = os.path.join(filedir, "locale") - if not os.path.isdir(dir): - dir = os.path.join(os.path.dirname(sys.argv[0]), "locale") - if not os.path.isdir(dir): - dir = os.path.abspath(os.path.join(filedir, "..", "locale")) - return dir + return "/usr/share/locale" def setLang(lang, local=True): trans = gettext.translation( diff --git a/aqt/__init__.py b/aqt/__init__.py index 1645209..5605d8c 100644 --- a/aqt/__init__.py +++ b/aqt/__init__.py @@ -157,7 +157,7 @@ def setupLang(pm, app, force=None): app.setLayoutDirection(Qt.LeftToRight) # qt _qtrans = QTranslator() - if _qtrans.load("qt_" + lang, dir): + if _qtrans.load("qt_" + lang, "/usr/share/qt5/translations"): app.installTranslator(_qtrans) # App initialisation |