Ken Thomases wrote:
On Nov 30, 2009, at 5:31 PM, Bruno Haible wrote:
This means that a POSIX compliant program has to do the following steps in order to determine the locale for a certain category of settings.
- Inspect the LC_ALL environment variable. If it is set and non-empty, use its value.
- Otherwise: Inspect the LC_xxxx environment variable that matches the specific category. If it is set and non-empty, use its value.
- Otherwise: Inspect the LANG environment variable. If it is set and non-empty, use its value.
- Otherwise: Use the default locale. On MacOS X systems, this means to use user preferences that can be retrieved using the CFLocaleCopyCurrent, CFPreferencesCopyAppValue functions. Note that these settings are similar but not entirely equal to Unix (glibc) conventions (e.g. "zh-Hans" vs. "zh_CN"), therefore some mapping of names has to be done.
By this logic, virtual no end-user program on any given Mac is compliant.
Gettext and POSIX-compliance is one thing. The user-desired behavior for Mac programs is another.
This algorithm is used in all programs that rely on GNU gettext and works perfectly fine:
- By default, no LANG or LC_* environment variable is set, hence the programs obey the user settings.
- For users of Terminal.app, who set these environment variables, the programs obey the environment variables.
It is Terminal.app itself which is setting LANG for all shells it creates, by default. The user is most likely oblivious to this fact.
The idea behind most of the MacIntosh 'magic' is that the user is deliberately oblivous to this. I just ran the set command in a terminal.app session, of which I have several running right now, and it was set to en_US.utf8, which is what I expect because the 'American' flag is displayed in the top information bar (also called the 'Apple' bar.) Gert may want to run the set command in a terminal session and given what was said, the LANG setting should be en_ZA.utf8, which is what I expect for South African English.
The Wine project could use this as a default with the Mac, which is not POSIX compliant.
James McKenzie