getLocaleInfo

Syntax

int getLocaleInfo (int locale, int type, char * buffer, int buffer_size)

Arguments

locale
The locale identifier LCID of the locale or one of the constants LOCALE_SYSTEM_DEFAULT or LOCALE_USER_DEFAULT to specify either the system or user's default locale.
type
An identifier for the type of information required. See below for a list of constants for this argument.
buffer
Pointer to a character array (string) used to store the requested information.
buffer_size
The maximum size of the buffer, this value should be the size of the allocated string or 255 in case you're using one of the predeclared strings (str0 upto str9).

Return

A value indicating the success (6) or a possible error which occurred.
0 = Insufficient buffer
5 = Invalid type
6 = Success
7 = Invalid locale identifier

Description

specify.

Example

Also see

(specify)?

Type constants

The following is a list constants for all existing types of locale info.

ConstantDescription
LOCALE_ILANGUAGELanguage identifier indicating the language. The maximum number of characters allowed for this string is 5.
LOCALE_SLANGUAGEFull localized name of the language.
LOCALE_SENGLANGUAGEFull English name of the language from the International Organization for Standardization (ISO) Standard 639. This is always restricted to characters mappable into the ASCII 127-character subset.
LOCALE_SABBREVLANGNAMEAbbreviated name of the language, created by taking the 2-letter language abbreviation from the ISO Standard 639 and adding a third letter, as appropriate, to indicate the sublanguage.
LOCALE_SNATIVELANGNAMENative name of the language.
LOCALE_ICOUNTRYCountry code, based on international phone codes, also referred to as IBM country codes. The maximum number of characters allowed for this string is 6.
LOCALE_SCOUNTRYFull localized name of the country.
LOCALE_SENGCOUNTRYFull English name of the country. This is always restricted to characters mappable into the ASCII 127-character subset.
LOCALE_SABBREVCTRYNAMEAbbreviated name of the country from the ISO Standard 3166.
LOCALE_SNATIVECTRYNAMENative name of the country.
LOCALE_IDEFAULTLANGUAGELanguage identifier for the principal language spoken in this locale. This is provided so that partially specified locales can be completed with default values. The maximum number of characters allowed for this string is 5.
LOCALE_IDEFAULTCOUNTRYCountry code for the principal country in this locale. This is provided so that partially specified locales can be completed with default values. The maximum number of characters allowed for this string is 6.
LOCALE_IDEFAULTCODEPAGEOriginal equipment manufacturer (OEM) code page associated with the country. The maximum number of characters allowed for this string is 6.
LOCALE_SLISTCharacter(s) used to separate list items. For example, a comma is used in many locales.
LOCALE_IMEASURESystem of measurement. This value is 0 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_SDECIMALCharacter(s) used as the decimal separator.
LOCALE_STHOUSANDCharacter(s) used to separate groups of digits to the left of the decimal.
LOCALE_SGROUPINGSizes for each group of digits to the left of the decimal. An explicit size is needed for each group; sizes are separated by semicolons. If the last value is zero, the preceding value is repeated. To group thousands, specify 3;0, for example.
LOCALE_IDIGITSNumber of fractional digits. The maximum number of characters allowed for this string is 3.
LOCALE_ILZEROSpecifier for leading zeros in decimal fields. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values: 0 = No leading zeros, 1 = Leading zeros
LOCALE_SNATIVEDIGITSNative equivalents to ASCII 0 through 9.
LOCALE_SCURRENCYString used as the local monetary symbol.
LOCALE_SINTLSYMBOLThree characters of the international monetary symbol specified in ISO 4217, "Codes for the Representation of Currencies and Funds," followed by the character separating this string from the amount.
LOCALE_SMONDECIMALSEPCharacter(s) used as the monetary decimal separator.
LOCALE_SMONTHOUSANDSEPCharacter(s) used as the monetary separator between groups of digits to the left of the decimal.
LOCALE_SMONGROUPINGSizes for each group of monetary digits to the left of the decimal. An explicit size is needed for each group; sizes are separated by semicolons. If the last value is zero, the preceding value is repeated. To group thousands, specify 3;0, for example.
LOCALE_ICURRDIGITSNumber of fractional digits for the local monetary format. The maximum number of characters allowed for this string is 3.
LOCALE_IINTLCURRDIGITSNumber of fractional digits for the international monetary format. The maximum number of characters allowed for this string is 3.
LOCALE_ICURRENCYPositive currency mode. The maximum number of characters allowed for this string is 2. The mode can be one of the following values: 0 = Prefix, no separation, 1 = Suffix, no separation, 2 = Prefix, 1-char. separation, 3 = Suffix, 1-char. separation
LOCALE_INEGCURRNegative currency mode. The maximum number of characters allowed for this string is 3. The mode can be one of the following values (right side is an example): 0 = ($1.1), 1 = -$1.1, 2 = $-1.1, 3 = $1.1-, 4 = (1.1$), 5 = -1.1$, 6 = 1.1-$, 7 = 1.1$-, 8 = -1.1 $ (space before $), 9 = -$ 1.1 (space after $), 10 = 1.1 $- (space before $), 11 = $ 1.1- (space after $), 12 = $ -1.1 (space after $), 13 = 1.1- $ (space before $), 14 = ($ 1.1) (space after $), 15 = (1.1 $) (space before $)
LOCALE_SDATECharacter(s) for the date separator.
LOCALE_STIMECharacter(s) for the time separator.
LOCALE_STIMEFORMATTime formatting strings for this locale.
LOCALE_SSHORTDATEShort date formatting string for this locale.
LOCALE_SLONGDATELong date formatting string for this locale.
LOCALE_IDATEShort date format-ordering specifier. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values: 0 = Month-Day-Year, 1 = Day-Month-Year, 2 = Year-Month-Day
LOCALE_ILDATELong date format-ordering specifier. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values: 0 = Month-Day-Year, 1 = Day-Month-Year, 2 = Year-Month-Day
LOCALE_ITIMETime format specifier. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values: 0 = AM / PM 12-hour format, 1 = 24-hour format
LOCALE_ICENTURYSpecifier for full 4-digit century. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values: 0 = Abbreviated 2-digit century, 1 = Full 4-digit century
LOCALE_ITLZEROSpecifier for leading zeros in time fields. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values: 0 = No leading zeros for hours, 1 = Leading zeros for hours
LOCALE_IDAYLZEROSpecifier for leading zeros in day fields. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values: 0 = No leading zeros for days, 1 = Leading zeros for days
LOCALE_IMONLZEROSpecifier for leading zeros in month fields. The maximum number of characters allowed for this string is 2. The specifier can be one of the following values: 0 = No leading zeros for months, 1 = Leading zeros for months
LOCALE_S1159String for the AM designator.
LOCALE_S2359String for the PM designator.
LOCALE_SDAYNAME1Native long name for Monday.
LOCALE_SDAYNAME2Native long name for Tuesday.
LOCALE_SDAYNAME3Native long name for Wednesday.
LOCALE_SDAYNAME4Native long name for Thursday.
LOCALE_SDAYNAME5Native long name for Friday.
LOCALE_SDAYNAME6Native long name for Saturday.
LOCALE_SDAYNAME7Native long name for Sunday.
LOCALE_SABBREVDAYNAME1Native abbreviated name for Monday.
LOCALE_SABBREVDAYNAME2Native abbreviated name for Tuesday.
LOCALE_SABBREVDAYNAME3Native abbreviated name for Wednesday.
LOCALE_SABBREVDAYNAME4Native abbreviated name for Thursday.
LOCALE_SABBREVDAYNAME5Native abbreviated name for Friday.
LOCALE_SABBREVDAYNAME6Native abbreviated name for Saturday.
LOCALE_SABBREVDAYNAME7Native abbreviated name for Sunday.
LOCALE_SMONTHNAME1Native long name for January.
LOCALE_SMONTHNAME2Native long name for February.
LOCALE_SMONTHNAME3Native long name for March.
LOCALE_SMONTHNAME4Native long name for April.
LOCALE_SMONTHNAME5Native long name for May.
LOCALE_SMONTHNAME6Native long name for June.
LOCALE_SMONTHNAME7Native long name for July.
LOCALE_SMONTHNAME8Native long name for August.
LOCALE_SMONTHNAME9Native long name for September.
LOCALE_SMONTHNAME10Native long name for October.
LOCALE_SMONTHNAME11Native long name for November.
LOCALE_SMONTHNAME12Native long name for December.
LOCALE_SABBREVMONTHNAME1Native abbreviated name for January.
LOCALE_SABBREVMONTHNAME2Native abbreviated name for February.
LOCALE_SABBREVMONTHNAME3Native abbreviated name for March.
LOCALE_SABBREVMONTHNAME4Native abbreviated name for April.
LOCALE_SABBREVMONTHNAME5Native abbreviated name for May.
LOCALE_SABBREVMONTHNAME6Native abbreviated name for June.
LOCALE_SABBREVMONTHNAME7Native abbreviated name for July.
LOCALE_SABBREVMONTHNAME8Native abbreviated name for August.
LOCALE_SABBREVMONTHNAME9Native abbreviated name for September.
LOCALE_SABBREVMONTHNAME10Native abbreviated name for October.
LOCALE_SABBREVMONTHNAME11Native abbreviated name for November.
LOCALE_SABBREVMONTHNAME12Native abbreviated name for December.
LOCALE_SPOSITIVESIGNString value for the positive sign.
LOCALE_SNEGATIVESIGNString value for the negative sign.
LOCALE_IPOSSIGNPOSNFormatting index for positive values. The maximum number of characters allowed for this string is 2. The index can be one of the following values: 0 = Parentheses surround the amount and the monetary symbol, 1 = The sign string precedes the amount and the monetary symbol, 2 = The sign string succeeds the amount and the monetary symbol, 3 = The sign string immediately precedes the monetary symbol, 4 = The sign string immediately succeeds the monetary symbol.
LOCALE_INEGSIGNPOSNFormatting index for negative values. This index uses the same values as LOCALE_IPOSSIGNPOSN. The maximum number of characters allowed for this string is 2.
LOCALE_IPOSSYMPRECEDESPosition of monetary symbol in a positive monetary value. This value is 1 if the monetary symbol precedes the positive amount, 0 if it follows it. The maximum number of characters allowed for this string is 2.
LOCALE_IPOSSEPBYSPACESeparation of monetary symbol in a positive monetary value. This value is 1 if the monetary symbol is separated by a space from a positive amount, 0 if it is not. The maximum number of characters allowed for this string is 2.
LOCALE_INEGSYMPRECEDESPosition of monetary symbol in a negative monetary value. This value is 1 if the monetary symbol precedes the negative amount, 0 if it follows it. The maximum number of characters allowed for this string is 2.
LOCALE_INEGSEPBYSPACESeparation of monetary symbol in a negative monetary value. This value is 1 if the monetary symbol is separated by a space from the negative amount, 0 if it is not. The maximum number of characters allowed for this string is 2.
LOCALE_NOUSEROVERRIDEThis constant may be OR'ed with any other LCTYPE constant in a call to the GetLocaleInfo function. This always causes the function to bypass any user overrides, and return the system default value for the other LCTYPE specified in the function call, based on the given LCID.

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.