mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-12 10:10:30 +03:00
implement gettext localization
This allows all the text to be localized via Weblate. This is a quick overview of all the strings, but there are certainly some that were left out. closes #342
This commit is contained in:
parent
e4ca82d80c
commit
278d67d960
24 changed files with 285 additions and 235 deletions
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
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__), '..')),
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue