Add locale.exe option for querying Windows UI languages

Andy Koppe
Sat Oct 8 09:24:00 GMT 2011

The attached patch adds a --interface/-i option to locale.exe that
makes the --system/-s and --user/-u options print the respective
default UI language instead of the default locale.

	* Add --interface option for printing Windows default UI

For background, here's what Windows' various default locales and languages do:

- LOCALE_USER_DEFAULT: This reflects the setting on the Formats tab of
the (Windows 7) Region&Language control panel, which affects the
format of times, dates, numbers, and currency.

- LOCALE_SYSTEM_DEFAULT: This reflects the "Language for non-Unicode
programs" on the Adminstrative tab of Region&Language control panel,
which also determines the ANSI and OEM codepages.

- GetUserDefaultUILanguage(): This is the current user's Windows UI
language, also called display language. On Windows installs with
multiple UI languages, a setting for this appears on the "Keyboards
and Languages" tab of the Region&Language control panel.

- GetSystemDefaultUILanguage(): The is the system-wide UI language
used for things that aren't user-specific, e.g. the login screen. As
far as I know it's determined at Windows install time and can''t be

(The latter two APIs are available from Windows 2000 onwards.)

Looking at those, and if we wanted to base the Cygwin locale settings
on the Windows ones, I think LC_NUMERIC, LC_TIME, and LC_MONETARY
should be determined by LOCALE_USER_DEFAULT, but LC_MESSAGES should be
determined by GetUserDefaultUILanguage(). Not sure about LC_CTYPE and
LC_COLLATE, but I suppose it would make sense for character
classification and sorting to match the UI language.

See also this blog post by MS's "Dr International" Michael Kaplan:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ui_lang.patch
Type: application/octet-stream
Size: 1778 bytes
Desc: not available
URL: <>

More information about the Cygwin-patches mailing list