[py3k] fix i18n
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 05 Oct 2015 17:57:03 +0200
changeset 10776 b1834143fec8
parent 10775 4b3c1069bd4e
child 10777 eabacd3c6f16
[py3k] fix i18n
i18n.py
--- a/i18n.py	Tue Oct 06 11:44:51 2015 +0200
+++ b/i18n.py	Mon Oct 05 17:57:03 2015 +0200
@@ -25,6 +25,8 @@
 from os.path import join, basename, splitext, exists
 from glob import glob
 
+from six import PY2
+
 from cubicweb.toolsutils import create_dir
 
 def extract_from_tal(files, output_file):
@@ -40,10 +42,10 @@
 
 def add_msg(w, msgid, msgctx=None):
     """write an empty pot msgid definition"""
-    if isinstance(msgid, unicode):
+    if PY2 and isinstance(msgid, unicode):
         msgid = msgid.encode('utf-8')
     if msgctx:
-        if isinstance(msgctx, unicode):
+        if PY2 and isinstance(msgctx, unicode):
             msgctx = msgctx.encode('utf-8')
         w('msgctxt "%s"\n' % msgctx)
     msgid = msgid.replace('"', r'\"').splitlines()