[PATCH] kernel32: Respect the LANG environment variable on Mac OS.

Ken Thomases ken at codeweavers.com
Wed Nov 25 10:46:26 CST 2009


On Nov 24, 2009, at 7:52 AM, Charles Davis wrote:

> I just realized something. The reason Wine doesn't respect LANG is that
> it overrides the LC_MESSAGES setting if it is set to the default. It
> will be set to the default if there is no LC_MESSAGES in the
> environment. So we don't want to override LC_MESSAGES if there's a LANG
> variable in the environment. Besides, why do all that work if we're not
> going to override LANG anyway if it's already set?

Mac OS X's Language & Text (formerly known as International) settings in System Preferences don't quite map exactly to Unix LANG or LC_* environment variables, which are a poor intermediary for mapping to Windows settings.

The user's preferred language corresponds to LC_MESSAGES in intent.  All the other LC_* variables correspond roughly to the settings on the Formats tab of the preference pane.

One problem with trusting the LANG variable is that its UNIX semantics are as a fallback for the LC_* variables, not an override.  Given that the user has selected a language and formats in System Preferences, that's like setting all of the various LC_* variables, so LANG should be ignored.

Allowing LANG to override the user's preference settings would make Wine behave badly when run from Terminal.app if the user's preferred language and formats don't match (e.g. Japanese language, U.S. formats).  Terminal (at least, recent versions) has a setting in its preferences to set the locale environment variables in shells it creates.  However, it really only sets LANG according to the Region selected on the Formats tab.  It does not set individual LC_* variables.  It completely ignores the user's preferred language.  If Wine were to rely on LANG, then all users with mismatched language and formats who launch it from Terminal would not get their preferred language.

If you as a user want to override the language that Wine displays, you can set LC_MESSAGES in your environment rather than LANG.  Setting LC_ALL would achieve that, plus override the various other locale categories.  Set LANG is the wrong approach, in my opinion.

-Ken




More information about the wine-devel mailing list