[PATCH 16 of 21 WIP-PY3K] i18n: use new gettext on py3k and str for unicode type

Matthew Turk matthewturk at gmail.com
Mon Oct 12 16:25:00 CDT 2015


# HG changeset patch
# User Matthew Turk <matthewturk at gmail.com>
# Date 1444684279 18000
#      Mon Oct 12 16:11:19 2015 -0500
# Node ID 1842237016d2b252a9060941a850f54b90451b9e
# Parent  9c4bc93e95dd668b4458a1e6a209901b5587ee44
i18n: use new gettext on py3k and str for unicode type

diff -r 9c4bc93e95dd -r 1842237016d2 mercurial/i18n.py
--- a/mercurial/i18n.py	Mon Oct 12 16:10:57 2015 -0500
+++ b/mercurial/i18n.py	Mon Oct 12 16:11:19 2015 -0500
@@ -45,10 +45,16 @@
     localedir = os.path.join(datapath, 'locale')
     t = gettextmod.translation('hg', localedir, _languages, fallback=True)
     global _ugettext
-    _ugettext = t.ugettext
+    if sys.version_info[0] < 3:
+        _ugettext = t.ugettext
+    else:
+        _ugettext = t.gettext
 
 _msgcache = {}
 
+if sys.version_info[0] >= 3:
+    unicode = str
+
 def gettext(message):
     """Translate message.
 


More information about the Mercurial-devel mailing list