[PATCH] kernel32: Respect the LANG environment variable on Mac OS.
ken at codeweavers.com
Wed Dec 9 14:51:38 CST 2009
On Dec 9, 2009, at 1:34 PM, Ken Thomases wrote:
> So, I'm making a new proposal: the Mac formats region will be used
> to set LANG unconditionally. (Passing 1 for the third argument to
> setenv() rather than 0.) The current code for overwriting
> lcid_LC_MESSAGES will be tweaked. Instead of looking at whether
> lcid_LC_MESSAGES has been set to something other than lcid_LC_CTYPE,
> it will look at whether LC_ALL or LC_MESSAGES were set in the
> environment. If they were, it leaves lcid_LC_MESSAGES alone. If
> they were not, it overwrites it using the existing method.
Now I've reconsidered a bit more. I'm not going to overwrite LANG
For most of this discussion, I've been pretty hostile toward LANG.
The main problem with it is that Terminal.app sets it, this setting is
based on region and not language, and therefore if we honor LANG for
LC_MESSAGES, the user gets the wrong language.
Given that we're going to continue overwriting lcid_LC_MESSAGES using
the Mac OS X settings, just under different conditions than
previously, Terminal's LANG is not so problematic. In fact, it's
likely exactly equal to what our code will now generate for LANG.
(Gert's reporting shows that Terminal sometimes doesn't set LANG at
all and only sets LC_CTYPE, because it detects that the region doesn't
have a valid locale definition for the C library. In this case, Wine
will set LANG, because it isn't already set, but that will be invalid
and everything will default to the C locale, including LC_CTYPE. This
actually loses information. Unfortunately, there's not much we can do
about that. Wine has to set LANG if it isn't set because, for
example, Tiger's Terminal.app does not make any attempt to set locale
The big change between now and the beginning of this debate is that we
must acknowledge that the way to tell Wine to behave differently (e.g.
to test other languages and locales) is to set LC_ALL or the
individual LC_* variables. I still maintain that setting LANG has
never been the right approach for that. And setting LANG will
continue to be an incomplete override on the Mac (it won't get
LC_MESSAGES), as it is on Linux for a user with an LC_* in his or her
More information about the wine-devel