[PATCH 5 of 8] py3: convert to unicode to pass to gettext.translation

Pulkit Goyal 7895pulkit at gmail.com
Sat Nov 5 19:16:22 EDT 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1478384854 -19800
#      Sun Nov 06 03:57:34 2016 +0530
# Node ID 0c892b7a70b56a27d485562b4191eb44da625f5b
# Parent  95b462cda94a4cf9c399a3f3bae348923855542d
py3: convert to unicode to pass to gettext.translation

In one of the previous patch, we converted util.datapath as bytes. In this
case we have to pass bytes to gettext.translation otherwise it will cry. Used
pycompat.fsdecode() to decode it back to unicode as it was converted to bytes
using pycompat.fsencode()

diff -r 95b462cda94a -r 0c892b7a70b5 mercurial/i18n.py
--- a/mercurial/i18n.py	Sun Nov 06 03:44:44 2016 +0530
+++ b/mercurial/i18n.py	Sun Nov 06 03:57:34 2016 +0530
@@ -49,6 +49,7 @@
 _ugettext = None
 
 def setdatapath(datapath):
+    datapath = pycompat.fsdecode(datapath)
     localedir = os.path.join(datapath, pycompat.sysstr('locale'))
     t = gettextmod.translation('hg', localedir, _languages, fallback=True)
     global _ugettext


More information about the Mercurial-devel mailing list