LC_MESSAGES (was Re: [Python-Dev] test___all__ failing; Windows)

Peter Funk pf@artcom-gmbh.de
Wed, 24 Jan 2001 16:32:55 +0100 (MET)


Hi,

Skip Montanaro:
> 
>     Tim> Nevermind; checked in a hack to stop the error on Windows.
> 
> Probably should file a bug report (if you haven't already) so the root
> problem isn't forgotten because the hack obscures it.  I see this code in
> localemodule.c:
> 
>     #ifdef LC_MESSAGES
> 	x = PyInt_FromLong(LC_MESSAGES);
> 	PyDict_SetItemString(d, "LC_MESSAGES", x);
> 	Py_XDECREF(x);
>     #endif /* LC_MESSAGES */
> 
> Martin, looks like this module is your baby.  Care to hazard a guess about
> whether LC_MESSAGES should always or never be there?

AFAI found out, LC_MESSAGES was added to the POSIX "standard" in Posix.2.
Non-posix2 compatible systems probably miss the proper functionality 
behind 'setlocale()'.  So the best solution would be to add a clever
emulation/approximation of this feature, if the underlying platform
(here windows) doesn't provide it.   This would require to wrap 
'setlocale()'.  But I'm not sure how to emulate for example
'setlocale(LC_MESSAGES, 'DE_de') on a Windows box.  May be it is
impossible to achieve.  

What I would love to see is that the typical query
'setlocale(LC_MESSAGES)' would return 'DE_de' on a Box running for example
the german version of Windows or MacOS.  This would eliminate the need for
ugly language selection menus on these platforms in a portable fashion.

Regards, Peter