Как получить информацию о локальных настройках системы?

Previous  Top  Next

    
 

 

Delphi имеет функцию GetLocaleInfo, которая позволяет получать различную информацию о локальных настройках, таких как системный язык, символ валюты, количество десятичных знаков и т.д.

 

Далее приведена функция, которая возвращает значение в зависимости от параметра "flag":

Code:

........

function TForm1.GetLocaleInformation(Flag: Integer): String;

var

pcLCA:    Array[0..20] of Char;

begin

if( GetLocaleInfo(LOCALE_SYSTEM_DEFAULT,Flag,pcLCA,19) <= 0 ) then begin

   pcLCA[0] := #0;

end;

Result := pcLCA;

end;

........

 

 

 

Пример использования функции:

Code:

........

procedure TForm1.Button1Click(Sender: TObject);

begin

ShowMessage(GetLocaleInformation(LOCALE_SENGLANGUAGE));

end;

........

 

 

"Flag" может содержать следующее значение (если посмотреть в Windows.pas):

 

LOCALE_NOUSEROVERRIDE       { do not use user overrides }

LOCALE_USE_CP_ACP           { use the system ACP }

LOCALE_ILANGUAGE            { language id }

LOCALE_SLANGUAGE            { localized name of language }

LOCALE_SENGLANGUAGE         { English name of language }

LOCALE_SABBREVLANGNAME      { abbreviated language name }

LOCALE_SNATIVELANGNAME      { native name of language }

LOCALE_ICOUNTRY             { country code }

LOCALE_SCOUNTRY             { localized name of country }

LOCALE_SENGCOUNTRY          { English name of country }

LOCALE_SABBREVCTRYNAME      { abbreviated country name }

LOCALE_SNATIVECTRYNAME      { native name of country }

LOCALE_IDEFAULTLANGUAGE     { default language id }

LOCALE_IDEFAULTCOUNTRY      { default country code }

LOCALE_IDEFAULTCODEPAGE     { default oem code page }

LOCALE_IDEFAULTANSICODEPAGE { default ansi code page }

LOCALE_IDEFAULTMACCODEPAGE  { default mac code page }

LOCALE_SLIST                { list item separator }

LOCALE_IMEASURE             { 0 = metric, 1 = US }

LOCALE_SDECIMAL             { decimal separator }

LOCALE_STHOUSAND            { thousand separator }

LOCALE_SGROUPING            { digit grouping }

LOCALE_IDIGITS              { number of fractional digits }

LOCALE_ILZERO               { leading zeros for decimal }

LOCALE_INEGNUMBER           { negative number mode }

LOCALE_SNATIVEDIGITS        { native ascii 0-9 }

LOCALE_SCURRENCY            { local monetary symbol }

LOCALE_SINTLSYMBOL          { intl monetary symbol }

LOCALE_SMONDECIMALSEP       { monetary decimal separator }

LOCALE_SMONTHOUSANDSEP      { monetary thousand separator }

LOCALE_SMONGROUPING         { monetary grouping }

LOCALE_ICURRDIGITS          { # local monetary digits }

LOCALE_IINTLCURRDIGITS      { # intl monetary digits }

LOCALE_ICURRENCY            { positive currency mode }

LOCALE_INEGCURR             { negative currency mode }

LOCALE_SDATE                { date separator }

LOCALE_STIME                { time separator }

LOCALE_SSHORTDATE           { short date format string }

LOCALE_SLONGDATE            { long date format string }

LOCALE_STIMEFORMAT          { time format string }

LOCALE_IDATE                { short date format ordering }

LOCALE_ILDATE               { long date format ordering }

LOCALE_ITIME                { time format specifier }

LOCALE_ITIMEMARKPOSN        { time marker position }

LOCALE_ICENTURY             { century format specifier (short date) }

LOCALE_ITLZERO              { leading zeros in time field }

LOCALE_IDAYLZERO            { leading zeros in day field (short date) }

LOCALE_IMONLZERO            { leading zeros in month field (short date) }

LOCALE_S1159                { AM designator }

LOCALE_S2359                { PM designator }

LOCALE_ICALENDARTYPE        { type of calendar specifier }

LOCALE_IOPTIONALCALENDAR    { additional calendar types specifier }

LOCALE_IFIRSTDAYOFWEEK      { first day of week specifier }

LOCALE_IFIRSTWEEKOFYEAR     { first week of year specifier }

LOCALE_SDAYNAME1            { long name for Monday }

LOCALE_SDAYNAME2            { long name for Tuesday }

LOCALE_SDAYNAME3            { long name for Wednesday }

LOCALE_SDAYNAME4            { long name for Thursday }

LOCALE_SDAYNAME5            { long name for Friday }

LOCALE_SDAYNAME6            { long name for Saturday }

LOCALE_SDAYNAME7            { long name for Sunday }

LOCALE_SABBREVDAYNAME1      { abbreviated name for Monday }

LOCALE_SABBREVDAYNAME2      { abbreviated name for Tuesday }

LOCALE_SABBREVDAYNAME3      { abbreviated name for Wednesday }

LOCALE_SABBREVDAYNAME4      { abbreviated name for Thursday }

LOCALE_SABBREVDAYNAME5      { abbreviated name for Friday }

LOCALE_SABBREVDAYNAME6      { abbreviated name for Saturday }

LOCALE_SABBREVDAYNAME7      { abbreviated name for Sunday }

LOCALE_SMONTHNAME1          { long name for January }

LOCALE_SMONTHNAME2          { long name for February }

LOCALE_SMONTHNAME3          { long name for March }

LOCALE_SMONTHNAME4          { long name for April }

LOCALE_SMONTHNAME5          { long name for May }

LOCALE_SMONTHNAME6          { long name for June }

LOCALE_SMONTHNAME7          { long name for July }

LOCALE_SMONTHNAME8          { long name for August }

LOCALE_SMONTHNAME9          { long name for September }

LOCALE_SMONTHNAME10         { long name for October }

LOCALE_SMONTHNAME11         { long name for November }

LOCALE_SMONTHNAME12         { long name for December }

LOCALE_SMONTHNAME13         { long name for 13th month (if exists) }

LOCALE_SABBREVMONTHNAME1    { abbreviated name for January }

LOCALE_SABBREVMONTHNAME2    { abbreviated name for February }

LOCALE_SABBREVMONTHNAME3    { abbreviated name for March }

LOCALE_SABBREVMONTHNAME4    { abbreviated name for April }

LOCALE_SABBREVMONTHNAME5    { abbreviated name for May }

LOCALE_SABBREVMONTHNAME6    { abbreviated name for June }

LOCALE_SABBREVMONTHNAME7    { abbreviated name for July }

LOCALE_SABBREVMONTHNAME8    { abbreviated name for August }

LOCALE_SABBREVMONTHNAME9    { abbreviated name for September }

LOCALE_SABBREVMONTHNAME10   { abbreviated name for October }

LOCALE_SABBREVMONTHNAME11   { abbreviated name for November }

LOCALE_SABBREVMONTHNAME12   { abbreviated name for December }

LOCALE_SABBREVMONTHNAME13   { abbreviated name for 13th month (if exists) }

LOCALE_SPOSITIVESIGN        { positive sign }

LOCALE_SNEGATIVESIGN        { negative sign }

LOCALE_IPOSSIGNPOSN         { positive sign position }

LOCALE_INEGSIGNPOSN         { negative sign position }

LOCALE_IPOSSYMPRECEDES      { mon sym precedes pos amt }

LOCALE_IPOSSEPBYSPACE       { mon sym sep by space from pos amt }

LOCALE_INEGSYMPRECEDES      { mon sym precedes neg amt }

LOCALE_INEGSEPBYSPACE       { mon sym sep by space from neg amt }

LOCALE_FONTSIGNATURE        { font signature }

LOCALE_SISO639LANGNAME      { ISO abbreviated language name }

LOCALE_SISO3166CTRYNAME     { ISO abbreviated country name }

©Drkb::01957

Взято из http://forum.sources.ru