changeset 28674:03d1ecbbd81e

py3: handle ugettext + unicode in i18n
author timeless <timeless@mozdev.org>
date Tue, 29 Mar 2016 17:22:08 +0000
parents e78613c13f1d
children fcafd84bc9c5
files mercurial/i18n.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/i18n.py	Mon Mar 28 22:30:23 2016 +0000
+++ b/mercurial/i18n.py	Tue Mar 29 17:22:08 2016 +0000
@@ -20,6 +20,10 @@
 else:
     module = __file__
 
+try:
+    unicode
+except NameError:
+    unicode = str
 
 _languages = None
 if (os.name == 'nt'
@@ -45,7 +49,10 @@
     localedir = os.path.join(datapath, 'locale')
     t = gettextmod.translation('hg', localedir, _languages, fallback=True)
     global _ugettext
-    _ugettext = t.ugettext
+    try:
+        _ugettext = t.ugettext
+    except AttributeError:
+        _ugettext = t.gettext
 
 _msgcache = {}