summaryrefslogtreecommitdiffstats
path: root/pykolab/utils.py
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:15:57 +0100
commit0e0c89b4f89d15a01aef61689ec899fa2a958e2d (patch)
treeb6c72071040c6c0ce97ed36d3cdbfdf09dc66362 /pykolab/utils.py
parent44cf0065f458714edec23b1d6b093426cd493de1 (diff)
downloadpykolab-0e0c89b4f89d15a01aef61689ec899fa2a958e2d.tar.gz
Prevent utils.translate() traceback (#842)
Diffstat (limited to 'pykolab/utils.py')
-rw-r--r--pykolab/utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pykolab/utils.py b/pykolab/utils.py
index ba9e13c..33fc3ca 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -355,7 +355,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))