summaryrefslogtreecommitdiff
path: root/pykolab/translate.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-07-10 10:26:46 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-07-10 10:26:46 (GMT)
commit5d97d7f2da3d97930941c081c8bbba7de687863f (patch)
tree2af18265a15d147abd7c5e30fb11139be91977ec /pykolab/translate.py
parent6b3df45c2cc13f5fcc3320404881cbff0a8f012e (diff)
downloadpykolab-5d97d7f2da3d97930941c081c8bbba7de687863f.tar.gz
Implement gettext language switch; remove en.po as this is not used
Diffstat (limited to 'pykolab/translate.py')
-rw-r--r--pykolab/translate.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/pykolab/translate.py b/pykolab/translate.py
index 85f4516..080cbc2 100644
--- a/pykolab/translate.py
+++ b/pykolab/translate.py
@@ -26,9 +26,10 @@ import gettext
import os
N_ = lambda x: x
-_ = lambda x: gettext.ldgettext(domain, x)
+_ = lambda x: current.lgettext(x)
-#gettext.bindtextdomain(domain, '/usr/local/share/locale')
+localedir = '/usr/local/share/locale'
+current = gettext.translation(domain, localedir, fallback=True)
def getDefaultLangs():
languages = []
@@ -49,15 +50,14 @@ def getDefaultLangs():
return nelangs
def setUserLanguage(lang):
+ global current
+
langs = []
for l in gettext._expand_lang(lang):
if l not in langs:
langs.append(l)
try:
- translation = gettext.translation(domain, languages=langs)
- translation.install()
+ current = gettext.translation(domain, localedir, languages=langs, fallback=True)
except:
- return False
-
- return True
+ pass