Alias ugettext to gettext method of cwGNUTranslations in Python 3
The former does not exist in Python 3, but we rely on it.
This fixes test_login_bad_password in cubicweb/pyramid/test/test_login.py
which has never passed since being introduced in 6392f34fcdad.
--- a/cubicweb/cwgettext.py Wed Nov 16 14:38:11 2016 +0100
+++ b/cubicweb/cwgettext.py Thu Nov 17 10:47:52 2016 +0100
@@ -18,6 +18,8 @@
import gettext
+from six import PY3
+
class cwGNUTranslations(gettext.GNUTranslations):
# The encoding of a msgctxt and a msgid in a .mo file is
@@ -83,6 +85,9 @@
else:
return msgid2
+ if PY3:
+ ugettext = gettext.GNUTranslations.gettext
+
def upgettext(self, context, message):
ctxt_message_id = self.CONTEXT_ENCODING % (context, message)
missing = object()