summaryrefslogtreecommitdiff
path: root/lib/i18n.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-11-18 12:56:38 +0100
committerGitHub <noreply@github.com>2024-11-18 12:56:38 +0100
commita66ae845f1f62ab6106c02663d2b191a35c9361f (patch)
treed19fa099c96b6fdbfaf769c6245ac0d797748c85 /lib/i18n.py
parentdde0444ac29f663579e70c1214ca4faa9862f0a6 (diff)
Print-pdf: simplify path detection (#3282)
* print-pdf: simplify path detection * i18n: more cleaning up * Version, License paths
Diffstat (limited to 'lib/i18n.py')
-rw-r--r--lib/i18n.py16
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/i18n.py b/lib/i18n.py
index 0a35ae25..2a901a0e 100644
--- a/lib/i18n.py
+++ b/lib/i18n.py
@@ -5,10 +5,8 @@
import gettext
import os
-import sys
-from os.path import dirname, realpath
-from .utils import cache
+from .utils import cache, get_resource_dir
_ = translation = None
locale_dir = None
@@ -23,17 +21,7 @@ def N_(message): return message
def _set_locale_dir():
global locale_dir
-
- if getattr(sys, 'frozen', False):
- # we are in a pyinstaller installation
- locale_dir = sys._MEIPASS
- else:
- locale_dir = dirname(dirname(realpath(__file__)))
-
- if sys.platform == "darwin" and getattr(sys, 'frozen', False):
- locale_dir = os.path.join(locale_dir, "..", 'Resources', 'locales')
- else:
- locale_dir = os.path.join(locale_dir, 'locales')
+ locale_dir = get_resource_dir('locales')
def localize(languages=None):