{-------------------------------------------------------------} {----Purpose : VCL wrapper for GetLocaleInfo API. } { By : Ir. G.W. van der Vegt } { For : Myself & MadExcept. } {-------------------------------------------------------------} { ddmmyy comment } { -------- ---------------------------------------------------} { 11022005-Initial version. } { 12022005-Added Subclasses for Days and Months to improve } { readablility. } { -Added properties for accessing } { LOCALE_SYSTEM_DEFAULT & LOCALE_USER_DEFAULT } { -Turned integer properties into real Integers. } { 23052005-Added stored false to all properties to prevent } { storage of values in dfm files. } { 19062005-madshi: now works as a madExcept 3.0 plugin } { 10072005-madshi: some little adjustments for new 3.0 beta } {-------------------------------------------------------------} { TODO } { 1. Group properties in sub classes for readability. } { Like Language, Numbers, Formats. } { 2. See if we can dump arrays too. } { 3. See if we can dump it side by side (for 4 locales? The } { two constants and the two properties). } {-------------------------------------------------------------} unit LocaleInfo; interface function GetLocaleReport : string; implementation uses Windows, SysUtils, madExcept, madDumpObj; {$M+} type TLocaleDayNames = class private { Private declarations } protected { Protected declarations } fSName1: string; fSName2: string; fSName3: string; fSName4: string; fSName5: string; fSName6: string; fSName7: string; published { Published declarations } property SName1: string read fSName1; property SName2: string read fSName2; property SName3: string read fSName3; property SName4: string read fSName4; property SName5: string read fSName5; property SName6: string read fSName6; property SName7: string read fSName7; end; TLocaleMonthNames = class private { Private declarations } protected { Protected declarations } fSName01: string; fSName02: string; fSName03: string; fSName04: string; fSName05: string; fSName06: string; fSName07: string; fSName08: string; fSName09: string; fSName10: string; fSName11: string; fSName12: string; fSName13: string; published { Published declarations } property SName01: string read fSName01; property SName02: string read fSName02; property SName03: string read fSName03; property SName04: string read fSName04; property SName05: string read fSName05; property SName06: string read fSName06; property SName07: string read fSName07; property SName08: string read fSName08; property SName09: string read fSName09; property SName10: string read fSName10; property SName11: string read fSName11; property SName12: string read fSName12; property SName13: string read fSName13; end; TLocaleInfo = class private { Private declarations } fAbbrDayNames: TLocaleDayNames; fAbbrMonthNames: TLocaleMonthNames; fDayNames: TLocaleDayNames; fICalendarType: Integer; fICentury: Integer; fICountry: Integer; fICurrDigits: Integer; fICurrency: Integer; fIDate: Integer; fIDayLZero: Integer; fIDefaultAnsiCodePage: Integer; fIDefaultCodePage: Integer; fIDefaultCountry: Integer; fIDefaultLanguage: Integer; // fIDefaultOemCodePage: string; fIDigits: Integer; fIFirstDayOfWeek: Integer; fIFirstWeekOfYear: Integer; fIIntlCurrDigits: Integer; fILanguage: Integer; fILDate: Integer; fILZero: Integer; fIMeasure: Integer; fIMonLZero: Integer; fINegCurr: Integer; fINegNumber: Integer; fINegSepBySpace: Integer; fINegSignPosN: Integer; fINegSymPrecedes: Integer; fIOptionalCalandar: Integer; fIPosSignPosN: Integer; fIPossSepBySpace: Integer; fIPosSymPrecedes: Integer; fITime: Integer; fITlZero: Integer; fLocale: Integer; fMonthNames: TLocaleMonthNames; fNUO_ICurrency: Integer; fNUO_IDate: Integer; fNUO_ILDate: Integer; fNUO_INegCurr: Integer; fNUO_INegSepBySpace: Integer; fNUO_INegSignPosN: Integer; fNUO_INegSymPrecedes: Integer; fNUO_IPosSepBySpace: Integer; fNUO_IPosSignPosN: Integer; fNUO_IPosSymPrecedes: Integer; fNUO_ITime: Integer; fNUO_ITlZero: Integer; fNUO_SDate: string; fNUO_SLongDate: string; fNUO_SShortDate: string; fNUO_STime: string; fNUO_STimeFormat: string; fS1159: string; fS2359: string; fSAbbrCtryName: string; fSAbbrevLangName: string; fSCountry: string; fSCurreny: string; fSDate: string; fSDecimal: string; fSEngCountry: string; fSEngLanguage: string; fSGrouping: string; fSIntlSymbol: string; fSLanguage: string; fSList: string; fSLongDate: string; fSMonDecimalSep: string; fSMonGrouping: string; fSMonThousandSep: string; fSNativeCtryName: string; fSNativeDigits: string; fSNativeLangName: string; fSNegativeSign: string; fSPositiveSign: string; fSShortDate: string; fSThousand: string; fSTime: string; fSTimeFormat: string; public { Publicdeclarations } constructor Create; private procedure UpdateLocales; procedure UpdateLocaleStatus(var Item: Integer; const locale, id: Cardinal); overload; procedure UpdateLocaleStatus(var Item: string; const locale, id: Cardinal); overload; procedure SetDayNames(const Value: TLocaleDayNames); procedure SetLocale(const Value: Integer); procedure SetMonthNames(const Value: TLocaleMonthNames); procedure SetSDummy(const Value: string); function GetSystemLocale: Integer; function GetSystemLocaleConstant: Integer; function GetUserLocale: Integer; function GetUserLocaleConstant: Integer; published { Native abbreviated day names } property AbbrDayNames: TLocaleDayNames read fAbbrDayNames write SetDayNames stored False; { Native abbreviated month names. } property AbbrMonthNames: TLocaleMonthNames read fAbbrMonthNames write SetMonthNames stored False; { Native long day names } property DayNames: TLocaleDayNames read fDayNames write SetDayNames stored False; { Current calendar type. This type can be one of these values: 1 Gregorian(as in United States) 2 Gregorian(English strings always) 3 Era: Year of the Emperor(Japan) 4 Era: Year of the Republic of China 5 Tangun Era(Korea) } property ICalendarType: Integer read fICalendarType; { Specifier 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 } property ICentury: Integer read fICentury; { Country code, based on international phone codes, also referred to as IBM country codes.The maximum number of characters allowed for this string is 6.} property ICountry: Integer read fICountry; { Number of fractional digits for the local monetary format. The maximum number of characters allowed for this string is 3. } property ICurrDigits: Integer read fICurrDigits; { Positive 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 } property ICurrency: Integer read fICurrency; { Short 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 } property IDate: Integer read fIDate; { Specifier 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 } property IDayLZero: Integer read fIDayLZero; { American National Standards Institute(ANSI)code page associated with this locale.The maximum number of characters allowed for this string is 6. } property IDefaultAnsiCodePage: Integer read fIDefaultAnsiCodePage; { Original equipment manufacturer(OEM)code page associated with the country. The maximum number of characters allowed for this string is 6. } property IDefaultCodePage: Integer read fIDefaultCodePage; { Country 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. } property IDefaultCountry: Integer read fIDefaultCountry; { Language 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. } property IDefaultLanguage: Integer read fIDefaultLanguage; // { Original equipment manufacturer(OEM)code page associated with the locale. // The maximum number of characters allowed for this string is 6. } // property IDefaultOemCodePage: string read fIDefaultOemCodePage write SetIDummy; { Number of fractional digits.The maximum number of characters allowed for this string is 3. } property IDigits: Integer read fIDigits; { Specifier for the first day in a week.The specifier can be one of these values: 0 LOCALE_SDAYNAME1 1 LOCALE_SDAYNAME2 2 LOCALE_SDAYNAME3 3 LOCALE_SDAYNAME4 4 LOCALE_SDAYNAME5 5 LOCALE_SDAYNAME6 6 LOCALE_SDAYNAME7 } property IFirstDayOfWeek: Integer read fIFirstDayOfWeek; { Specifier for the first week of the year.The specifier can be one of these values: 0 Week containing 1 / 1 is the first week of that year. 1 First full week following 1 / 1 is the first week of that year. 2 First week containing at least 4 days is the first week of that year. } property IFirstWeekOfYear: Integer read fIFirstWeekOfYear; { Number of fractional digits for the international monetary format. The maximum number of characters allowed for this string is 3. } property IIntlCurrDigits: Integer read fIIntlCurrDigits; { Language identifier indicating the language. The maximum number of characters allowed for this string is 5. } property ILanguage: Integer read fILanguage; { Long 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 } property ILDate: Integer read fILDate; { Specifier 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 } property ILZero: Integer read fILZero; { System of measurement.This value is 0 if the metric system (Systéme International d'Unités, or S.I.) is used 1 if the U.S. system is used. The maximum number of characters allowed for this string is 2. } property IMeasure: Integer read fIMeasure; { Specifier 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 } property IMonLZero: Integer read fIMonLZero; { Negative currency mode.The maximum number of characters allowed for this string is 3. The mode can be one of the following values: 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 $) } property INegCurr: Integer read fINegCurr; { Negative number mode.The mode can be one of these values: 0(1.1) 1 - 1.1 2 - 1.1 3 1.1 - 4 1.1 - } property INegNumber: Integer read fINegNumber; { Separation 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. } property INegSepBySpace: Integer read fINegSepBySpace; { Formatting index for negative values. This index uses the same values as LOCALE_IPOSSIGNPOSN. The maximum number of characters allowed for this string is 2. } property INegSignPosN: Integer read fINegSignPosN; { Position 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. } property INegSymPrecedes: Integer read fINegSymPrecedes; { Additional calendar types.This can be a zero - separated list of one or more of these calendars type values: 0 No additional types valid 1 Gregorian(as in United States) 2 Gregorian(English strings always) 3 Era: Year of the Emperor(Japan) 4 Era: Year of the Republic of China 5 Tangun Era(Korea) } property IOptionalCalandar: Integer read fIOptionalCalandar; { Formatting 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. } property IPosSignPosN: Integer read fIPosSignPosN; { Separation 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. } property IPossSepBySpace: Integer read fIPossSepBySpace; { Position 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. } property IPosSymPrecedes: Integer read fIPosSymPrecedes; { Time 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 } property ITime: Integer read fITime; { Specifier 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 } property ITlZero: Integer read fITlZero; { Set the Locale Identifier to be Shown } property Locale: Integer read fLocale write SetLocale stored False; { Native long month names. } property MonthNames: TLocaleMonthNames read fMonthNames write SetMonthNames stored False; { Can be combined with other LOCALE values to bypass any user override and return the system default value for the given locale information. Many of the locale types listed above are closely related, such that changing one affects the value of others.The following shows the relationships between these types. } property NUO_ICurrency: Integer read fNUO_ICurrency; property NUO_IDate: Integer read fNUO_IDate; property NUO_ILDate: Integer read fNUO_ILDate; property NUO_INegCurr: Integer read fNUO_INegCurr; property NUO_INegSepBySpace: Integer read fNUO_INegSepBySpace; property NUO_INegSignPosN: Integer read fNUO_INegSignPosN; property NUO_INegSymPrecedes: Integer read fNUO_INegSymPrecedes; property NUO_IPosSepBySpace: Integer read fNUO_IPosSepBySpace; property NUO_IPosSignPosN: Integer read fNUO_IPosSignPosN; property NUO_IPosSymPrecedes: Integer read fNUO_IPosSymPrecedes; property NUO_ITime: Integer read fNUO_ITime; property NUO_ITlZero: Integer read fNUO_ITlZero; property NUO_SDate: string read fNUO_SDate write SetSDummy stored False; property NUO_SLongDate: string read fNUO_SLongDate write SetSDummy stored False; property NUO_SShortDate: string read fNUO_SShortDate write SetSDummy stored False; property NUO_STime: string read fNUO_STime write SetSDummy stored False; property NUO_STimeFormat: string read fNUO_STimeFormat write SetSDummy stored False; { string for the AM designator. } property S1159: string read fS1159 write SetSDummy stored False; { string for the PM designator. } property S2359: string read fS2359 write SetSDummy stored False; { Abbreviated name of the country from the ISO Standard 3166. } property SAbbrCtryName: string read fSAbbrCtryName write SetSDummy stored False; { Abbreviated 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. } property SAbbrevLangName: string read fSAbbrevLangName write SetSDummy stored False; { Full localized name of the country. } property SCountry: string read fSCountry write SetSDummy stored False; { string used as the local monetary symbol. } property SCurreny: string read fSCurreny write SetSDummy stored False; { Character(s)for the date separator. } property SDate: string read fSDate write SetSDummy stored False; { Character(s)used as the decimal separator. } property SDecimal: string read fSDecimal write SetSDummy stored False; { Full English name of the country.This is always restricted to characters mappable into the ASCII 127 - character subset. } property SEngCountry: string read fSEngCountry write SetSDummy stored False; { Full 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. } property SEngLanguage: string read fSEngLanguage write SetSDummy stored False; { Sizes 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. } property SGrouping: string read fSGrouping write SetSDummy stored False; { Three 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. } property SIntlSymbol: string read fSIntlSymbol write SetSDummy stored False; { Full localized name of the language. } property SLanguage: string read fSLanguage write SetSDummy stored False; { Character(s)used to separate list items.For example, a comma is used in many locales. } property SList: string read fSList write SetSDummy stored False; { Long date formatting string for this locale.The string can consist of a combination of day, month, and year format pictures defined in in the Day, Month, Year, and Era Format Pictures table in National Language Support Constants and any string of characters enclosed in single quotes. Characters in single quotes remain as given. } property SLongDate: string read fSLongDate write SetSDummy stored False; { Character(s)used as the monetary decimal separator. } property SMonDecimalSep: string read fSMonDecimalSep write SetSDummy stored False; { Sizes 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. } property SMonGrouping: string read fSMonGrouping write SetSDummy stored False; { Character(s)used as the monetary separator between groups of digits to the Left of the decimal. } property SMonThousandSep: string read fSMonThousandSep write SetSDummy stored False; { Native name of the country. } property SNativeCtryName: string read fSNativeCtryName write SetSDummy stored False; { Native equivalents to ASCII 0 through 9. } property SNativeDigits: string read fSNativeDigits write SetSDummy stored False; { Native name of the language. } property SNativeLangName: string read fSNativeLangName write SetSDummy stored False; { string value for the negative sign. } property SNegativeSign: string read fSNegativeSign write SetSDummy stored False; { string value for the positive sign. } property SPositiveSign: string read fSPositiveSign write SetSDummy stored False; { Short date formatting string for this locale.The string can consist of a combination of day, month, and year format pictures defined in in Day, Month, Year, and Era Format Pictures table in National Language Support Constants. } property SShortDate: string read fSShortDate write SetSDummy stored False; { Character(s)used to separate groups of digits to the Left of the decimal. } property SThousand: string read fSThousand write SetSDummy stored False; { Character(s)for the time separator. } property STime: string read fSTime write SetSDummy stored False; { Time formatting strings for this locale.The string can consist of a combination of the hour, minute, and second format pictures defined in in the Hour, Minute, and Second Format Pictures table in National Language Support Constants. } property STimeFormat: string read fSTimeFormat write SetSDummy stored False; { Get System Default Locale Identifier } property SystemLocale: Integer read GetSystemLocale; { Get LOCALE_SYSTEM_DEFAULT } property SystemLocaleConstant: Integer read GetSystemLocaleConstant; { Get User Default Locale Identifier } property UserLocale: Integer read GetUserLocale; { Get LOCALE_USER_DEFAULT } property UserLocaleConstant: Integer read GetUserLocaleConstant; end; {$M-} { TLocaleInfo } constructor TLocaleInfo.Create; begin inherited; fLocale := GetUserLocale; fAbbrDayNames := TLocaleDayNames.Create; fDayNames := TLocaleDayNames.Create; fAbbrMonthNames := TLocaleMonthNames.Create; fMonthNames := TLocaleMonthNames.Create; UpdateLocales; end; procedure TLocaleInfo.UpdateLocales(); begin UpdateLocaleStatus(fILanguage, fLocale, LOCALE_ILANGUAGE); UpdateLocaleStatus(fSLanguage, fLocale, LOCALE_SLANGUAGE); UpdateLocaleStatus(fSEngLanguage, fLocale, LOCALE_SENGLANGUAGE); UpdateLocaleStatus(fSAbbrevLangName, fLocale, LOCALE_SABBREVLANGNAME); UpdateLocaleStatus(fSNativeLangName, fLocale, LOCALE_SNATIVELANGNAME); UpdateLocaleStatus(fICountry, fLocale, LOCALE_ICOUNTRY); UpdateLocaleStatus(fSCountry, fLocale, LOCALE_SCOUNTRY); UpdateLocaleStatus(fSEngCountry, fLocale, LOCALE_SENGCOUNTRY); UpdateLocaleStatus(fSAbbrCtryName, fLocale, LOCALE_SABBREVCTRYNAME); UpdateLocaleStatus(fSNativeCtryName, fLocale, LOCALE_SNATIVECTRYNAME); UpdateLocaleStatus(fIDefaultLanguage, fLocale, LOCALE_IDEFAULTLANGUAGE); UpdateLocaleStatus(fIDefaultCountry, fLocale, LOCALE_IDEFAULTCOUNTRY); UpdateLocaleStatus(fIDefaultAnsiCodePage, fLocale, LOCALE_IDEFAULTANSICODEPAGE); //UpdateLocaleStatus(fIDefaultOemCodePage, fLocale, LOCALE_IDEFAULTOEMCODEPAGE); UpdateLocaleStatus(fIDefaultCodePage, fLocale, LOCALE_IDEFAULTCODEPAGE); UpdateLocaleStatus(fSList, fLocale, LOCALE_SLIST); UpdateLocaleStatus(fIMeasure, fLocale, LOCALE_IMEASURE); UpdateLocaleStatus(fSDecimal, fLocale, LOCALE_SDECIMAL); UpdateLocaleStatus(fSThousand, fLocale, LOCALE_STHOUSAND); UpdateLocaleStatus(fSGrouping, fLocale, LOCALE_SGROUPING); UpdateLocaleStatus(fIDigits, fLocale, LOCALE_IDIGITS); UpdateLocaleStatus(fILZero, fLocale, LOCALE_ILZERO); UpdateLocaleStatus(fINegNumber, fLocale, LOCALE_INEGNUMBER); UpdateLocaleStatus(fSNativeDigits, fLocale, LOCALE_SNATIVEDIGITS); UpdateLocaleStatus(fSCurreny, fLocale, LOCALE_SCURRENCY); UpdateLocaleStatus(fSIntlSymbol, fLocale, LOCALE_SINTLSYMBOL); UpdateLocaleStatus(fSMonDecimalSep, fLocale, LOCALE_SMONDECIMALSEP); UpdateLocaleStatus(fSMonThousandSep, fLocale, LOCALE_SMONTHOUSANDSEP); UpdateLocaleStatus(fSMonGrouping, fLocale, LOCALE_SMONGROUPING); UpdateLocaleStatus(fICurrDigits, fLocale, LOCALE_ICURRDIGITS); UpdateLocaleStatus(fIIntlCurrDigits, fLocale, LOCALE_IINTLCURRDIGITS); UpdateLocaleStatus(fICurrency, fLocale, LOCALE_ICURRENCY); UpdateLocaleStatus(fINegCurr, fLocale, LOCALE_INEGCURR); UpdateLocaleStatus(fSDate, fLocale, LOCALE_SDATE); UpdateLocaleStatus(fSTime, fLocale, LOCALE_STIME); UpdateLocaleStatus(fSTimeFormat, fLocale, LOCALE_STIMEFORMAT); UpdateLocaleStatus(fSShortDate, fLocale, LOCALE_SSHORTDATE); UpdateLocaleStatus(fSLongDate, fLocale, LOCALE_SLONGDATE); UpdateLocaleStatus(fIDate, fLocale, LOCALE_IDATE); UpdateLocaleStatus(fILDate, fLocale, LOCALE_ILDATE); UpdateLocaleStatus(fITime, fLocale, LOCALE_ITIME); UpdateLocaleStatus(fICentury, fLocale, LOCALE_ICENTURY); UpdateLocaleStatus(fITlZero, fLocale, LOCALE_ITLZERO); UpdateLocaleStatus(fIDayLZero, fLocale, LOCALE_IDAYLZERO); UpdateLocaleStatus(fIMonLZero, fLocale, LOCALE_IMONLZERO); UpdateLocaleStatus(fS1159, fLocale, LOCALE_S1159); UpdateLocaleStatus(fS2359, fLocale, LOCALE_S2359); UpdateLocaleStatus(fICalendarType, fLocale, LOCALE_ICALENDARTYPE); UpdateLocaleStatus(fIOptionalCalandar, fLocale, LOCALE_IOPTIONALCALENDAR); UpdateLocaleStatus(fIFirstDayOfWeek, fLocale, LOCALE_IFIRSTDAYOFWEEK); UpdateLocaleStatus(fIFirstWeekOfYear, fLocale, LOCALE_IFIRSTWEEKOFYEAR); UpdateLocaleStatus(fNUO_ICurrency, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_ICURRENCY); UpdateLocaleStatus(fNUO_IPosSepBySpace, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_IPOSSEPBYSPACE); UpdateLocaleStatus(fNUO_IPosSymPrecedes, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_IPOSSYMPRECEDES); UpdateLocaleStatus(fNUO_INegCurr, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_INEGCURR); UpdateLocaleStatus(fNUO_INegSepBySpace, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_INEGSEPBYSPACE); UpdateLocaleStatus(fNUO_INegSymPrecedes, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_INEGSYMPRECEDES); UpdateLocaleStatus(fNUO_INegSignPosN, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_INEGSIGNPOSN); UpdateLocaleStatus(fNUO_IPosSignPosN, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_IPOSSIGNPOSN); UpdateLocaleStatus(fNUO_SShortDate, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_SSHORTDATE); UpdateLocaleStatus(fNUO_SDate, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_SDATE); UpdateLocaleStatus(fNUO_IDate, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_IDATE); UpdateLocaleStatus(fNUO_SLongDate, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_SLONGDATE); UpdateLocaleStatus(fNUO_ILDate, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_ILDATE); UpdateLocaleStatus(fNUO_STimeFormat, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_STIMEFORMAT); UpdateLocaleStatus(fNUO_STime, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_STIME); UpdateLocaleStatus(fNUO_ITime, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_ITIME); UpdateLocaleStatus(fNUO_ITlZero, fLocale, LOCALE_NOUSEROVERRIDE or LOCALE_ITLZERO); UpdateLocaleStatus(fMonthNames.fSName01, fLocale, LOCALE_SMONTHNAME1); UpdateLocaleStatus(fMonthNames.fSName02, fLocale, LOCALE_SMONTHNAME2); UpdateLocaleStatus(fMonthNames.fSName03, fLocale, LOCALE_SMONTHNAME3); UpdateLocaleStatus(fMonthNames.fSName04, fLocale, LOCALE_SMONTHNAME4); UpdateLocaleStatus(fMonthNames.fSName05, fLocale, LOCALE_SMONTHNAME5); UpdateLocaleStatus(fMonthNames.fSName06, fLocale, LOCALE_SMONTHNAME6); UpdateLocaleStatus(fMonthNames.fSName07, fLocale, LOCALE_SMONTHNAME7); UpdateLocaleStatus(fMonthNames.fSName08, fLocale, LOCALE_SMONTHNAME8); UpdateLocaleStatus(fMonthNames.fSName09, fLocale, LOCALE_SMONTHNAME9); UpdateLocaleStatus(fMonthNames.fSName10, fLocale, LOCALE_SMONTHNAME10); UpdateLocaleStatus(fMonthNames.fSName11, fLocale, LOCALE_SMONTHNAME11); UpdateLocaleStatus(fMonthNames.fSName12, fLocale, LOCALE_SMONTHNAME12); UpdateLocaleStatus(fMonthNames.fSName13, fLocale, LOCALE_SMONTHNAME13); UpdateLocaleStatus(fAbbrMonthNames.fSName01, fLocale, LOCALE_SABBREVMONTHNAME1); UpdateLocaleStatus(fAbbrMonthNames.fSName02, fLocale, LOCALE_SABBREVMONTHNAME2); UpdateLocaleStatus(fAbbrMonthNames.fSName03, fLocale, LOCALE_SABBREVMONTHNAME3); UpdateLocaleStatus(fAbbrMonthNames.fSName04, fLocale, LOCALE_SABBREVMONTHNAME4); UpdateLocaleStatus(fAbbrMonthNames.fSName05, fLocale, LOCALE_SABBREVMONTHNAME5); UpdateLocaleStatus(fAbbrMonthNames.fSName06, fLocale, LOCALE_SABBREVMONTHNAME6); UpdateLocaleStatus(fAbbrMonthNames.fSName07, fLocale, LOCALE_SABBREVMONTHNAME7); UpdateLocaleStatus(fAbbrMonthNames.fSName08, fLocale, LOCALE_SABBREVMONTHNAME8); UpdateLocaleStatus(fAbbrMonthNames.fSName09, fLocale, LOCALE_SABBREVMONTHNAME9); UpdateLocaleStatus(fAbbrMonthNames.fSName10, fLocale, LOCALE_SABBREVMONTHNAME10); UpdateLocaleStatus(fAbbrMonthNames.fSName11, fLocale, LOCALE_SABBREVMONTHNAME11); UpdateLocaleStatus(fAbbrMonthNames.fSName12, fLocale, LOCALE_SABBREVMONTHNAME12); UpdateLocaleStatus(fAbbrMonthNames.fSName13, fLocale, LOCALE_SABBREVMONTHNAME13); UpdateLocaleStatus(fSPositiveSign, fLocale, LOCALE_SPOSITIVESIGN); UpdateLocaleStatus(fSNegativeSign, fLocale, LOCALE_SNEGATIVESIGN); UpdateLocaleStatus(fIPosSignPosN, fLocale, LOCALE_IPOSSIGNPOSN); UpdateLocaleStatus(fINegSignPosN, fLocale, LOCALE_INEGSIGNPOSN); UpdateLocaleStatus(fIPosSymPrecedes, fLocale, LOCALE_IPOSSYMPRECEDES); UpdateLocaleStatus(fIPossSepBySpace, fLocale, LOCALE_IPOSSEPBYSPACE); UpdateLocaleStatus(fINegSymPrecedes, fLocale, LOCALE_INEGSYMPRECEDES); UpdateLocaleStatus(fINegSepBySpace, fLocale, LOCALE_INEGSEPBYSPACE); UpdateLocaleStatus(fDayNames.fSName1, fLocale, LOCALE_SDAYNAME1); UpdateLocaleStatus(fDayNames.fSName2, fLocale, LOCALE_SDAYNAME2); UpdateLocaleStatus(fDayNames.fSName3, fLocale, LOCALE_SDAYNAME3); UpdateLocaleStatus(fDayNames.fSName4, fLocale, LOCALE_SDAYNAME4); UpdateLocaleStatus(fDayNames.fSname5, fLocale, LOCALE_SDAYNAME5); UpdateLocaleStatus(fDayNames.fSName6, fLocale, LOCALE_SDAYNAME6); UpdateLocaleStatus(fDayNames.fSName7, fLocale, LOCALE_SDAYNAME7); UpdateLocaleStatus(fAbbrDayNames.fSName1, fLocale, LOCALE_SABBREVDAYNAME1); UpdateLocaleStatus(fAbbrDayNames.fSName2, fLocale, LOCALE_SABBREVDAYNAME2); UpdateLocaleStatus(fAbbrDayNames.fSName3, fLocale, LOCALE_SABBREVDAYNAME3); UpdateLocaleStatus(fAbbrDayNames.fSName4, fLocale, LOCALE_SABBREVDAYNAME4); UpdateLocaleStatus(fAbbrDayNames.fSName5, fLocale, LOCALE_SABBREVDAYNAME5); UpdateLocaleStatus(fAbbrDayNames.fSName6, fLocale, LOCALE_SABBREVDAYNAME6); UpdateLocaleStatus(fAbbrDayNames.fSName7, fLocale, LOCALE_SABBREVDAYNAME7); end; procedure TLocaleInfo.UpdateLocaleStatus(var Item: Integer; const locale, id: Cardinal); var s : string; begin UpdateLocaleStatus(s, locale, id); if (s <> '') then Item := StrToInt(s) else Item := 0; end; procedure TLocaleInfo.UpdateLocaleStatus(var Item: string; const locale, id: Cardinal); {$WARNINGS OFF} var sz : PChar; siz : Integer; begin siz := GetLocaleInfo(locale, id, nil, 0); sz := AllocMem(siz + 2); ZeroMemory(sz, siz + 2); GetLocaleInfo(locale, id, sz, siz); Item := StrPas(sz); FreeMem(sz); {$WARNINGS ON} end; procedure TLocaleInfo.SetDayNames(const Value: TLocaleDayNames); begin // Dummy end; procedure TLocaleInfo.SetLocale(const Value: Integer); begin if fLocale <> Value then begin fLocale := Value; UpdateLocales; end; end; procedure TLocaleInfo.SetMonthNames(const Value: TLocaleMonthNames); begin // Dummy end; procedure TLocaleInfo.SetSDummy(const Value: string); begin //Dummy Routine. end; function TLocaleInfo.GetSystemLocale: Integer; begin Result := GetSystemDefaultLCID(); end; function TLocaleInfo.GetSystemLocaleConstant: Integer; begin Result := LOCALE_SYSTEM_DEFAULT; end; function TLocaleInfo.GetUserLocale: Integer; begin Result := GetUserDefaultLCID(); end; function TLocaleInfo.GetUserLocaleConstant: Integer; begin Result := LOCALE_USER_DEFAULT; end; function GetLocaleReport : string; var li : TLocaleInfo; begin li := TLocaleInfo.Create; result := DumpObj(li); li.Free; end; initialization RegisterBugReportPlugin('locale info', 'extended locale information', GetLocaleReport); finalization UnregisterBugReportPlugin('locale info'); end.