This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients barry, serhiy.storchaka
Date 2018-05-31.11:00:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527764456.73.0.682650639539.issue33710@psf.upfronthosting.co.za>
In-reply-to
Content
Using gettext.lgettext() is the one of two right ways of doing translation in Python 2. In Python 2, gettext.gettext() returns a raw 8-bit string as it was written in the translation file. Since different translation files can use different encodings, and the locale encoding can be different from them, gettext.gettext() usually is not appropriate. gettext.lgettext() re-encodes all translated messages from file encodings to the specified one (or to the locale encoding by default). It works properly for str-based messages. Other right way is using gettext.ugettext() which returns a Unicode string.

In Python 3 gettext.gettext() was removed, and gettext.ugettext() was renamed to gettext.gettext(). This is the single right way. gettext.lgettext() still returns messages encoded to bytes, but since virtually all messages are Unicode strings in Python 3, it is virtually useless. At least I don't know any proper use case for it. In addition, gettext.lgettext() was half-broken up to recent times (see issue29755).

Seems gettext.lgettext() was not removed in Python 3.0 just due to an oversight. I suggest to deprecate it in 3.8 and remove it in future versions.
History
Date User Action Args
2018-05-31 11:00:56serhiy.storchakasetrecipients: + serhiy.storchaka, barry
2018-05-31 11:00:56serhiy.storchakasetmessageid: <1527764456.73.0.682650639539.issue33710@psf.upfronthosting.co.za>
2018-05-31 11:00:56serhiy.storchakalinkissue33710 messages
2018-05-31 11:00:56serhiy.storchakacreate