[Python-Dev] Adding more LANG support to locale.py (Re: gettext in the standard library) (original) (raw)

M.-A. Lemburg mal@lemburg.com
Mon, 21 Aug 2000 16:59:36 +0200


James Henstridge wrote:

On Sun, 20 Aug 2000, M.-A. Lemburg wrote: > James Henstridge wrote: > > 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 > > llCC.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() > > I'm not sure I can follow you here: are you saying that your > support in gettext.py does more or less than what's present > in locale.py ? > > If it's more, I think it would be a good idea to add those > parts to locale.py. It does a little more than the current locale.py. I just checked the current locale module, and it gives a ValueError exception when LANG is set to something like enAU:frFR. This sort of thing should be handled by the python interface to gettext, as it is by the C implementation (and I am sure that most programmers would not expect such an error from the locale module).

That usage of LANG is new to me... I wonder how well the multiple options settings fit the current API.

The code in my gettext module handles that case.

Would you be willing to supply a patch to locale.py which adds multiple LANG options to the interface ?

I guess we'd need a new API getdefaultlocales() [note the trailing "s"] which will then return a list of locale tuples rather than a single one. The standard getdefaultlocale() should then return whatever is considered to be the standard locale when using the multiple locale notation for LANG.

-- Marc-Andre Lemburg


Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/