SetLocaleInfo

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function sets an item of locale information. It does so by making an entry in the process portion of the locale table. This setting only affects the user override portion of the locale settings; it does not set the system defaults.

Note

If you specify a locale with the LCID (Locale ID) parameter and that locale is not installed or available on the Windows® phone, the function fails with ERROR_INVALID_PARAMETER. To determine whether the locale is supported or not, call IsValidLocale.

Syntax

BOOL SetLocaleInfo(
  LCID Locale, 
  LCTYPE LCType, 
  LPWTSTR lpLCData 
);

Parameters

  • Locale
    [in] Locale whose information the function will set. The locale provides a context for the string mapping or sort key generation. An application can use the MAKELCID macro to create a locale identifier.
  • LCType
    [in] Type of locale information to be set by the function. Note that only one LCTYPE may be specified per call. Not all LCTYPE values are valid; see the list of valid LCTYPE values in the following Remarks section.
  • lpLCData
    [in] Pointer to a null-terminated string that contains the locale information the function will set. The information must be in the specified LCTYPE's particular format.

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call the GetLastError function. The following table shows the possible values for GetLastError.

Value Description

ERROR_INVALID_ACCESS

The access code is invalid.

ERROR_INVALID_FLAGS

The flags are invalid.

ERROR_INVALID_PARAMETER

The parameter is incorrect, or the specified LCID is not supported on the device.

Remarks

The following table shows the LCTYPE values that are valid for this function.

Value Description

LOCALE_ICALENDARTYPE

Current calendar type. See LCTYPE Constants for exact values.

> [!NOTE] > If an image does not have a locale with a particular calendar type, then SetLocaleInfo will return ERROR_INVALID_PARAMETER. For example, on a US or Arabic image you cannot ask for a Japanese calander.

LOCALE_ICURRDIGITS

Number of fractional digits for the local monetary format. The maximum number of characters allowed for this string is 9.

LOCALE_ICURRENCY

Positive currency mode. The maximum number of characters allowed for this string is 2. See LCTYPE Constants for exact values.

LOCALE_IDIGITS

Number of fractional digits. The maximum number of characters allowed for this string is 3.

LOCALE_IFIRSTDAYOFWEEK

Specification for the first day in a week. See LCTYPE Constants for exact values.

LOCALE_IFIRSTWEEKOFYEAR

Specification for the first week of the year. See LCTYPE Constants for exact values.

LOCALE_ILZERO

Specification for leading zeros in decimal fields. The maximum number of characters allowed for this string is 2. See LCTYPE Constants for exact values.

LOCALE_IMEASURE

System of measurement. This value is zero if the metric system (Systéme International d'Unités, or S.I.) is used and 1 if the U.S. system is used. The maximum number of characters allowed for this string is 2.

LOCALE_INEGCURR

Negative currency mode. The maximum number of characters allowed for this string is 3. See LCTYPE Constants for exact values.

LOCALE_INEGNUMBER

Negative number mode. See LCTYPE Constants for exact values.

LOCALE_IPAPERSIZE

Default paper size associated with the locale.

LOCALE_ITIME

Time format specification. The maximum number of characters allowed for this string is 2. See LCTYPE Constants for exact values.

LOCALE_S1159

String for the AM designator.

LOCALE_S2359

String for the PM designator.

LOCALE_SCURRENCY

String used as the local monetary symbol.

LOCALE_SDATE

Character(s) for the date separator.

LOCALE_SDECIMAL

Character(s) used as the decimal separator.

LOCALE_SGROUPING

Sizes for each group of digits to the left of the decimal. An explicit size is needed for each group; semicolons separate sizes. If the last value is zero, the preceding value is repeated. To group thousands, specify 3; zero, for example.

LOCALE_SLIST

Character(s) used to separate list items. For example, a comma is used in many locales.

LOCALE_SLONGDATE

Long date formatting string for this locale. The string can consist of a combination of day, month, and year format pictures defined in the Day, Month, Year, and Era Format Pictures table in National Language Support Constantsand any string of characters enclosed in single quotes. Characters in single quotes remain as given.

LOCALE_SMONDECIMALSEP

Character(s) used as the monetary decimal separator.

LOCALE_SMONGROUPING

Sizes for each group of monetary digits to the left of the decimal. An explicit size is needed for each group; semicolons separate sizes. If the last value is zero, the preceding value is repeated. To group thousands, specify 3;0, for example.

LOCALE_SMONTHOUSANDSEP

Character(s) used as the monetary separator between groups of digits to the left of the decimal.

LOCALE_SNEGATIVESIGN

String value for the negative sign.

LOCALE_SPOSITIVESIGN

String value for the positive sign.

LOCALE_SSHORTDATE

Short date formatting string for this locale. The string can consist of a combination of day, month, and year format pictures defined in Day, Month, Year, and Era Format Pictures table in National Language Support Constants.

LOCALE_STHOUSAND

Character(s) used to separate groups of digits to the left of the decimal.

LOCALE_STIME

Character(s) for the time separator.

LOCALE_STIMEFORMAT

Time formatting strings for this locale. The string can consist of a combination of the hour, minute, and second format pictures defined in the Hour, Minute, and Second Format Pictures table in National Language Support Constants.

LOCALE_SYEARMONTH

The Year/Month formatting string for the locale. This string shows the proper format for a date string that contains only the year and the month.

It is only possible to set locale data if the locale supports the data's LCType. If the type is not supported for that locale, the call will be ignored and the value will not be set, even though the call's return type will be non–zero, indicating success. An example of a call that would provoke this behavior is trying to set the AM or PM designator, LOCALE_S1159 or LOCALE_S2359, within a Russian locale, since the Russian time system only uses a 24 hour clock.

Windows CE 1.0 through 2.01 do not support the LOCALE_IPAPERSIZE LCTYPE value.

For more information about LCTYPE, see LCTYPE Constants.

Requirements

Header winnls.h
Library Coreloc.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

GetLocaleInfo
MAKELCID
LCTYPE Constants