[Python-Dev] Re: gettext in the standard library

James Henstridge james@daa.com.au
Sat, 19 Aug 2000 22:14:12 +0800 (WST)


On Sat, 19 Aug 2000, M.-A. Lemburg wrote:

> > As I said above, most of that turned out not to be very useful.  Did you
> > include any of the language selection code in the last version of my
> > gettext module?  It gave behaviour very close to C gettext in this
> > respect.  It expands the locale name given by the user using the
> > locale.alias files found on the systems, then decomposes that into the
> > simpler forms.  For instance, if LANG=en_GB, then my gettext module would
> > search for catalogs by names:
> >   ['en_GB.ISO8859-1', 'en_GB', 'en.ISO8859-1', 'en', 'C']
> > 
> > This also allows things like expanding LANG=catalan to:
> >   ['ca_ES.ISO-8859-1', 'ca_ES', 'ca.ISO-8859-1', 'ca', 'C']
> > (provided the appropriate locale.alias files are found)
> > 
> > If you missed that that version I sent you I can send it again.  It
> > stripped out a lot of the experimental code giving a much simpler module.
> 
> Uhm, can't you make some use of the new APIs in locale.py
> for this ?
> 
> locale.py has a whole new set of encoding aware support for
> LANG variables. It supports Unix and Windows (thanks to /F).

Well, it can do a little more than that.  It will also handle the case of
a number of locales listed in the LANG environment variable.  It also
doesn't look like it handles decomposition of a locale like
ll_CC.encoding@modifier into other matching encodings in the correct
precedence order.

Maybe something to do this sort of decomposition would fit better in
locale.py though.

This sort of thing is very useful for people who know more than one
language, and doesn't seem to be handled by plain setlocale()

>  
> --
> Marc-Andre Lemburg

James.

-- 
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/