Re: python's gettext.gettext broken, use gettext.lgettext

2005-08-08 Thread Martin v. Löwis
Joe Wreschnig wrote:
> Which installs ugettext as '_' function into the __builtin__ namespace.
> That makes _ return Python 'unicode' objects, which is what programs
> should be using internally anyway.
> 
> This is harder if you're trying to localize a module since then you
> don't want to screw with __builtin__

It is also useless for the issues at hand: since linda and
apt-listchanges apparently use local strings, giving them Unicode
strings would break them. So Junichi's change looks right to me.

Regards,
Martin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: python's gettext.gettext broken, use gettext.lgettext

2005-08-08 Thread Steve Kowalik
On Mon, 08 Aug 2005 10:24:50 +0200, Martin v. Löwis uttered
> It is also useless for the issues at hand: since linda and
> apt-listchanges apparently use local strings, giving them Unicode
> strings would break them. So Junichi's change looks right to me.
> 
Standing up for Linda, I am more than willing to fix her usage of
gettext, and I am currently investigating using Joe's suggestion, to
see what that gives me. 

Anyway, in Python, unicode string objects behave the same as normal
string objects, so to my mind, the breakage should be minimal.

Cheers,
-- 
Steve
English is about as pure as a cribhouse whore. We don't just borrow
words; on occasion, English has pursued other languages down alleyways
to beat them unconscious and rifle their pockets for new vocabulary."
 - James D. Nicoll, resident of rec.arts.sf.written



Re: python's gettext.gettext broken, use gettext.lgettext

2005-08-08 Thread Junichi Uekawa

Hi,

> > It is also useless for the issues at hand: since linda and
> > apt-listchanges apparently use local strings, giving them Unicode
> > strings would break them. So Junichi's change looks right to me.
> > 
> Standing up for Linda, I am more than willing to fix her usage of
> gettext, and I am currently investigating using Joe's suggestion, to
> see what that gives me. 
> 
> Anyway, in Python, unicode string objects behave the same as normal
> string objects, so to my mind, the breakage should be minimal.

What's broken about linda currently, and what following Joe's 
suggestion will still break linda is that linda doesn't 
follow the current CODESET.

You'd expect iso-8859-1 output on stdout when the locale says so, and 
utf-8 output on stdout when the locale says so.

'ugettext' is a python's invention of gettext which only 
returns UTF-8; which you will have to call like:

print _("some string").encode(locale.nl_langinfo(CODESET))

as opposed to 

print _("some string")
(if _ is bound to lgettext).


regards,
junichi
-- 
Junichi Uekawa, Debian Developer   http://www.netfort.gr.jp/~dancer/
183A 70FC 4732 1B87 57A5  CE82 D837 7D4E E81E 55C1 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: python's gettext.gettext broken, use gettext.lgettext

2005-08-08 Thread Joe Wreschnig
On Mon, 2005-08-08 at 21:34 +0900, Junichi Uekawa wrote:
> Hi,
> 
> > > It is also useless for the issues at hand: since linda and
> > > apt-listchanges apparently use local strings, giving them Unicode
> > > strings would break them. So Junichi's change looks right to me.
> > > 
> > Standing up for Linda, I am more than willing to fix her usage of
> > gettext, and I am currently investigating using Joe's suggestion, to
> > see what that gives me. 
> > 
> > Anyway, in Python, unicode string objects behave the same as normal
> > string objects, so to my mind, the breakage should be minimal.
> 
> What's broken about linda currently, and what following Joe's 
> suggestion will still break linda is that linda doesn't 
> follow the current CODESET.
> 
> You'd expect iso-8859-1 output on stdout when the locale says so, and 
> utf-8 output on stdout when the locale says so.
> 
> 'ugettext' is a python's invention of gettext which only 
> returns UTF-8; which you will have to call like:

No, it doesn't return UTF-8, it returns unicode objects. They're
automatically recoded when you try to print them (based on the same
function lgettext uses, locale.getpreferredencoding()). As Steve said,
unicode objects are basically like str objects, so code changes should
be minimal. I'll take a look at Linda/Lintian soon to see what needs to
be done, but I suspect it'll be trivial.
-- 
Joe Wreschnig <[EMAIL PROTECTED]>


signature.asc
Description: This is a digitally signed message part