kernel32: Overhaul the locale determination on the Mac.
commitd90f29d817517b7c7bd6737f268598f0ccd5295a
authorKen Thomases <ken@codeweavers.com>
Wed, 15 Jun 2016 19:34:04 +0000 (15 14:34 -0500)
committerAlexandre Julliard <julliard@winehq.org>
Thu, 16 Jun 2016 15:09:19 +0000 (17 00:09 +0900)
treef0029ab8e5d28e42d0871fdc6f739a6f592b965e
parentbf4a2ba26405aacddd93a1cef16d0eda331f3c7b
kernel32: Overhaul the locale determination on the Mac.

The C library locale is inadequate for conveying the Mac user settings between
LOCALE_Init() and setup_unix_locales().  The set of locales supported by the C
library can't express the combinations allowed in user settings.

Setting LANG to a user-settings-derived locale when there's no corresponding C
library locale is actually worse than leaving it unset.  It will prevent the
C library from honoring the LC_* variables (other than LC_ALL).  That's why
Terminal.app won't set LANG in that case, it just sets LC_CTYPE=UTF-8.  This
commit makes Wine follow similar logic in not setting LANG if the C library
doesn't support the Mac user settings.

Rather, it uses a wrapper around setlocale() to query the locale.  That wrapper
returns a value representing the Mac user settings if the C library comes up
empty.  It also has logic to handle Terminal's setting LC_CTYPE=UTF-8, since
parse_locale_name() can't handle that properly.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
dlls/kernel32/locale.c