Get system default language

Posted in System info

Use GetSystemDefaultLangID function. It returns identifier of system language. And after that, use VerlanguageName procedure. It translates this identifier to PChar-string.

procedure TForm1.Button1Click(Sender: TObject);
var
  Ident: Integer;
  MyLang: PChar;
const
  Size: Integer = 250;  
begin
  GetMem(MyLang, Size);
  Ident:=GetSystemDefaultLangID;
  VerLanguageName(Ident, MyLang, Size);
  Label1.Caption:=StrPas(MyLang);
  FreeMem(MyLang);
end;