Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IsValidLocale function

[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.


BOOL IsValidLocale(
  _In_ LCID  Locale,
  _In_ DWORD dwFlags


Locale [in]

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.

dwFlags [in]

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


Determine if the locale identifier is both supported and installed.


Determine if the locale identifier is supported.


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.


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.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]


Winnls.h (include Windows.h)





See also

National Language Support
National Language Support Functions



© 2017 Microsoft