mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-14 19:10:11 +01:00
4ff50e9099
Wow, this is hacky and weird, but its been there for a long time. I don't know if its even relevant anymore, but is isolated so it shouldn't hurt anything. Plus there is a test for it in tests/complete-ci-tests, so it seems worth fixing.
24 lines
647 B
Python
24 lines
647 B
Python
|
|
import gettext
|
|
import glob
|
|
import os
|
|
import sys
|
|
|
|
|
|
# support running straight from git and standard installs
|
|
rootpaths = [
|
|
os.path.realpath(os.path.join(os.path.dirname(__file__), '..')),
|
|
os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'share')),
|
|
os.path.join(sys.prefix, 'share'),
|
|
]
|
|
|
|
localedir = None
|
|
for rootpath in rootpaths:
|
|
if len(glob.glob(os.path.join(rootpath, 'locale', '*', 'LC_MESSAGES', 'fdroidserver.mo'))) > 0:
|
|
localedir = os.path.join(rootpath, 'locale')
|
|
break
|
|
|
|
gettext.bindtextdomain('fdroidserver', localedir)
|
|
gettext.textdomain('fdroidserver')
|
|
_ = gettext.gettext
|