From patchwork Sat Nov 5 23:16:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5,of,8] py3: convert to unicode to pass to gettext.translation From: Pulkit Goyal <7895pulkit@gmail.com> X-Patchwork-Id: 17357 Message-Id: <0c892b7a70b56a27d485.1478387782@pulkit-goyal> To: mercurial-devel@mercurial-scm.org Date: Sun, 06 Nov 2016 04:46:22 +0530 # HG changeset patch # User Pulkit Goyal <7895pulkit@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