Default User and System Locales

Glossary

When a user installs Windows NT or Windows 95, he selects a default locale for the system. Although the user sets a single default locale, the setup program copies most international information for all other supported locales onto the user's hard drive, where applications can access them. The exceptions are the code page conversion tables, which are large. Setup copies code page conversion tables for only the initial default code page. Because Windows NT can save profile information for multiple users, each user can use Control Panel to select a custom default locale that is different from the default system locale chosen at setup.

Your application can use the functions listed in the first table below to retrieve the default user or system language or locale. You can use the constants in the second table as parameters to API calls that require a language ID or a locale ID.

Functions

User Defaults System Defaults
GetUserDefaultLangID GetSystemDefaultLangID
GetUserDefaultLCID GetSystemDefaultLCID
ConvertDefaultLocale ConvertDefaultLocale

Constants

User Defaults System Defaults
LANG_NEUTRAL, SUBLANG_NEUTRAL LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
LANG_NEUTRAL, SUBLANG_DEFAULT  
LOCALE_USER_DEFAULT LOCALE_SYSTEM_DEFAULT

Remember that Windows NT also supports the functions GetThreadLocale and SetThreadLocale, which server applications can call to compute information for a client in the locale that the client expects.

A user can change the default locale any time after installation by running the International application in Control Panel. (See Figure 5-6.) The country setting in the Windows NT 3.x Control Panel sets the default user formats for date, time, currency, and numbers.

Figure 5-6 The Windows NT 3.x International dialog box.

The user can then customize these formats in the International dialog box—the Control Panel applet calls SetLocaleInfo with the appropriate flag from the list in Figure 5-7 to update the registry.

LOCALE_ICALENDARTYPE LOCALE_SDATE
LOCALE_ICURRDIGITS LOCALE_SDECIMAL
LOCALE_ICURRENCY LOCALE_SGROUPING
LOCALE_IDIGITS LOCALE_SLIST
LOCALE_IFIRSTDAYOFWEEK LOCALE_SLONGDATE
LOCALE_IFIRSTWEEKOFYEAR LOCALE_SMONDECIMALSEP
LOCALE_ILZERO LOCALE_SMONGROUPING
LOCALE_IMEASURE LOCALE_SMONTHOUSANDSEP
LOCALE_INEGCURR LOCALE_SNEGATIVESIGN
LOCALE_INEGNUMBER LOCALE_SPOSITIVESIGN
LOCALE_ITIME LOCALE_SSHORTDATE
LOCALE_S1159 LOCALE_STHOUSAND
LOCALE_S2359 LOCALE_STIME
LOCALE_SCURRENCY LOCALE_STIMEFORMAT

Figure 5-7 LCTYPEs that SetLocaleInfo can override. The API accepts only locale IDs that are predefined by the system.

Calling GetLocaleInfo with the locale ID set to LOCALE_USER_DEFAULT will retrieve these customized settings unless you also specify the flag LOCALE_NOUSEROVERRIDE. The language setting determines the ACP (the local Windows code page), OEMCP (the MS-DOS–based code page), case conversion tables, and sorting tables. Windows 95's Control Panel (see Figure 5-8) works in much the same way, except the dialog box has been redesigned. The country and language settings found in the Windows NT 3.x dialog box are merged into a single regional setting in the Windows 95 dialog box, and the Windows 95 keyboard layout setting has been moved to a separate section of Control Panel.

Figure 5-8 The regional settings on the Windows 95 Control Panel.