summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aurweb/l10n.py5
-rw-r--r--conf/config.defaults1
-rw-r--r--web/lib/translator.inc.php3
3 files changed, 7 insertions, 2 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)
diff --git a/conf/config.defaults b/conf/config.defaults
index be37f430..c8bc3a7e 100644
--- a/conf/config.defaults
+++ b/conf/config.defaults
@@ -35,6 +35,7 @@ snapshot_uri = /cgit/aur.git/snapshot/%s.tar.gz
enable-maintenance = 1
maintenance-exceptions = 127.0.0.1
render-comment-cmd = /usr/local/bin/aurweb-rendercomment
+localedir = /srv/http/aurweb/aur.git/web/locale/
# memcache or apc
cache = none
memcache_servers = 127.0.0.1:11211
diff --git a/web/lib/translator.inc.php b/web/lib/translator.inc.php
index cd944c56..334d0e76 100644
--- a/web/lib/translator.inc.php
+++ b/web/lib/translator.inc.php
@@ -130,7 +130,8 @@ function set_lang() {
setcookie("AURLANG", $LANG, $cookie_time, "/");
}
- $streamer = new FileReader('../locale/' . $LANG .
+ $localedir = config_get('options', 'localedir');
+ $streamer = new FileReader($localedir . '/' . $LANG .
'/LC_MESSAGES/aurweb.mo');
$l10n = new gettext_reader($streamer, true);