summaryrefslogtreecommitdiffstats
path: root/aurweb/l10n.py
diff options
context:
space:
mode:
Diffstat (limited to 'aurweb/l10n.py')
-rw-r--r--aurweb/l10n.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/aurweb/l10n.py b/aurweb/l10n.py
new file mode 100644
index 00000000..e58e3fe2
--- /dev/null
+++ b/aurweb/l10n.py
@@ -0,0 +1,16 @@
+import gettext
+
+
+class Translator:
+ def __init__(self):
+ self._translator = {}
+
+ def translate(self, s, lang):
+ if lang == 'en':
+ return s
+ if lang not in self._translator:
+ self._translator[lang] = gettext.translation("aur",
+ "../../web/locale",
+ languages=[lang])
+ self._translator[lang].install()
+ return _(s)