Mojtaba Tajik
Mojtaba Tajik

Reputation: 1733

Get short windows language name

i get the list of installed language on windows with below code :

var 
  AList : array [0..9] of LongWord; 
  AklName: array [0..255] of Char; 
  i: Longint; 
begin 
  for i:= 0 to GetKeyboardLayoutList(SizeOf(AList), AList)- 1 do 
  begin 
    GetLocaleInfo(LoWord(AList[i]), LOCALE_SLANGUAGE, AklName, SizeOf(AklName)); 
    Memo1.Lines.AddObject(AklName, Pointer(AList[i])); 
  end; 
end;

it works correctly but i want get installed language in short names like ( English -> EN ; German -> de ; Persian -> FA) , any one can help me to change this code ?

Upvotes: 1

Views: 1519

Answers (2)

kutsoff
kutsoff

Reputation: 345

..or use LOCALE_SABBREVLANGNAME, but it will be display as 'ENG', 'RUS' etc.

Upvotes: 2

Rob Kennedy
Rob Kennedy

Reputation: 163257

Instead of LOCALE_SLANGUAGE, use one of the LOCALE_SISO* constants, probably LOCALE_SISO639LANGNAME.

Upvotes: 4

Related Questions