summaryrefslogtreecommitdiffstats
path: root/aurweb
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2018-07-22 10:41:57 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2018-08-06 06:03:52 +0200
commita7865ef5aa0309976b5dd2642210632babe106d9 (patch)
tree457e0841021b4a8ca129de02674f86de1bfc50af /aurweb
parentc8d99bac8ef96ac94bccdf3c754e7d43b3f1703c (diff)
downloadaur-a7865ef5aa0309976b5dd2642210632babe106d9.tar.gz
aur-a7865ef5aa0309976b5dd2642210632babe106d9.tar.xz
Make the locale directory configurable
Add a new configuration option to specify the locale directory to use. This allows the Python scripts to find the translations, even when not being run from the source code checkout. At the same time, multiple parallel aurweb setups can still use different sets of translations. Fixes FS#59278. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'aurweb')
-rw-r--r--aurweb/l10n.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/aurweb/l10n.py b/aurweb/l10n.py
index 66e0f1c0..a7c0103e 100644
--- a/aurweb/l10n.py
+++ b/aurweb/l10n.py
@@ -1,8 +1,11 @@
import gettext
+import aurweb.config
+
class Translator:
def __init__(self):
+ self._localedir = aurweb.config.get('options', 'localedir')
self._translator = {}
def translate(self, s, lang):
@@ -10,7 +13,7 @@ class Translator:
return s
if lang not in self._translator:
self._translator[lang] = gettext.translation("aurweb",
- "../../web/locale",
+ self._localedir,
languages=[lang])
self._translator[lang].install()
return _(s)