Programming/Delphi

Delphi Tip 로케일(Locale) 확인 하기

파란크리스마스 2010. 1. 20. 10:48
728x90

원본 사이트 : http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_10231553.html

procedure TForm1.Button1Click(Sender: TObject);

  function GetLocale(ALcid: Integer): string;
  var s: string;
  begin
    Result := '[Unknown]';
    SetLength(s, 128);
    if GetLocaleInfo(ALcid, LOCALE_SENGLANGUAGE, PChar(s), 128) > 0 then
      begin
        Result := StrPas(PChar(s));
        if GetLocaleInfo(ALcid, LOCALE_SENGCOUNTRY, PChar(s), 128) > 0 then
          begin
            Result := Format('%s (%s)', [Result, StrPas(PChar(s))]);
          end;
      end;
  end;

begin
  showmessage(GetLocale(GetUserDefaultLangID));
end;


 

728x90