Skip to content
Snippets Groups Projects
Commit 06102e7d authored by André's avatar André
Browse files

Linux: fix translation issue

parent 77014f09
No related branches found
No related tags found
No related merge requests found
......@@ -62,8 +62,23 @@ if os.name == 'nt':
if lang:
os.environ['LANG'] = lang
#gettext.install(APP, defs.localedir)
gettext.install(APP)
localedir = "../po"
else:
# try to find domain in localedir
path = gettext.find(APP)
if path:
# extract localedir from localedir/language/LC_MESSAGES/domain.mo
path, tail = os.path.split(path)
path, tail = os.path.split(path)
localedir, tail = os.path.split(path)
else: # fallback to user locale
base = os.getenv('XDG_DATA_HOME')
if base is None or base[0] != '/':
base = os.path.expanduser('~/.local/share')
localedir = os.path.join(base, "locale")
locale.bindtextdomain(APP, localedir)
gettext.install(APP, localedir)
if gettext._translations:
_translation = list(gettext._translations.values())[0]
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment