IsValidLocale function (winnls.h)

[IsValidLocale is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use IsValidLocaleName to determine the validity of a supplemental locale.]

Determines if the specified locale is installed or supported on the operating system. For more information, see Locales and Languages.

Syntax

BOOL IsValidLocale(
  [in] LCID  Locale,
  [in] DWORD dwFlags
);

Parameters

[in] Locale

Locale identifier of the locale to validate. You can use the MAKELCID macro to create a locale identifier or use one of the following predefined values.

[in] dwFlags

Flag specifying the validity test to apply to the locale identifier. This parameter can have one of the following values.

Value Meaning
LCID_INSTALLED
Determine if the locale identifier is both supported and installed.
LCID_SUPPORTED
Determine if the locale identifier is supported.
0x39
Do not use. Instead, use LCID_INSTALLED.

Windows Server 2008, Windows Vista, Windows Server 2003, Windows XP and Windows 2000:  Setting dwFlags to 0x39 is a special case that can behave like LCID_INSTALLED for some locales on some versions of Windows.

Return value

Returns a nonzero value if the locale identifier passes the specified validity test. The function returns 0 if it does not succeed.

Remarks

If the LCID_INSTALLED flag is specified and this function returns a nonzero value, the locale identifier is both supported and installed on the operating system. Having an identifier installed implies that the full level of language support is available for the indicated locale. Full support includes code page translation tables, keyboard layouts, fonts, and sorting and locale data.

If LCID_SUPPORTED is specified and this function returns 0, the locale identifier is supported in the release, but not necessarily installed on the operating system.

This function can handle data from custom locales. Data is not guaranteed to be the same from computer to computer or between runs of an application. If your application must persist or transmit data, see Using Persistent Locale Data.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winnls.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

GetLocaleInfo

IsValidLocaleName

National Language Support

National Language Support Functions