summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-14 15:15:57 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-14 15:16:24 +0100
commitbe82be3a3a0f06a8a4997ce13be2166b5637848b (patch)
tree4224aa02e204cb185882a2321acc47b62b9a30db /pykolab
parent58050404ca8c9fadc4cd30be00e848a490791895 (diff)
downloadpykolab-be82be3a3a0f06a8a4997ce13be2166b5637848b.tar.gz
Prevent utils.translate() traceback (#842)
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pykolab/utils.py b/pykolab/utils.py
index f0fa30a..a8ad952 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -282,7 +282,10 @@ def translate(mystring, locale_name='en_US'):
import locale
import subprocess
- (locale_name,locale_charset) = locale.normalize(locale_name).split('.')
+ if len(locale.normalize(locale_name).split('.')) > 1:
+ (locale_name,locale_charset) = locale.normalize(locale_name).split('.')
+ else:
+ locale_charset = 'utf-8'
locale.setlocale(locale.LC_ALL, (locale_name,locale_charset))