A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-April/034515.html below:

[I18n-sig] Changes to gettext.py for Python 2.3

[Python-Dev] Re: [I18n-sig] Changes to gettext.py for Python 2.3 [Python-Dev] Re: [I18n-sig] Changes to gettext.py for Python 2.3Barry Warsaw barry@python.org
11 Apr 2003 16:37:56 -0400
On Fri, 2003-04-11 at 15:54, "Martin v. Löwis" wrote:

> To avoid breakage, you could define ugettext as
> 
>    def ugettext(self, message):
>        if isinstance(message, unicode):
>           tmsg = self._catalog.get(message.encode(self._charset))
>           if tmsg is None:
>              return message
>        else:
>           tmsg = self._catalog.get(message, message)
>        return unicode(tmsg, self._charset)

I suppose we could cache the conversion to make the next lookup more
efficient.  Alternatively, if we always convert internally to Unicode we
could encode on .gettext().  Then we could just pick One Way and do away
with the coerce flag.

-Barry
    




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4