unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type 
  TForm1 =class (TForm)
    Memo1: TMemo;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    procedure Button1Click (Sender: TObject);
    procedure Button2Click (Sender: TObject);
    procedure Button3Click (Sender: TObject);
    procedure Button4Click (Sender: TObject);
  end ;

var
  Form1: TForm1;

implementation

{$ R * .dfm}

// Get the list of languages ​​supported by the system
procedure TForm1.Button1Click (Sender: TObject);
var
  i: Integer;
begin
  Memo1.Clear;
  for i: =0 to Languages.Count-1 do 
    Memo1.Lines.Add (Format ('% d:% s', [i, Languages.Name [i]]));
end ;

// Get Ext list of supported languages
procedure TForm1.Button2Click (Sender: TObject);
var
  i: Integer;
begin
  Memo1.Clear;
  for i: =0 to Languages.Count-1 do 
    Memo1.Lines.Add (Languages.Ext [i] +#9 + Languages.Name [i]);
end ;

// System default language ID and order in language list
procedure TForm1.Button3Click (Sender: TObject);
var
  LangID: Word;
  N: Integer;
begin
  LangID: = GetUserDefaultLangID;
  N: = Languages.IndexOf (LangID);
  ShowMessageFmt ('Current language ID:% d; Sort in list:% d', [LangID, N]);
   {Current language ID: 2052; Order of 67 in the list:% d}
end ;

//other
procedure TForm1.Button4Click (Sender: TObject);
var 
  s:string ;
begin 
  ShowMessage (Languages.ID [67]);                   // $ 00000804
  ShowMessage (IntToStr (Languages.LocaleID [67]));   // 2052

  ShowMessage (Languages.NameFromLCID ['2052']);     // Chinese (China)
  ShowMessage (Languages.NameFromLocaleID [2052]);   // Chinese (China)

  ShowMessage (GetUILanguages ​​(2052)); // zh-CN, zh-Hans, zh
  ShowMessage (PreferredUILanguages); // ZH-CN, ZH-HANS, ZH

  for sin PreferredUILanguageListdo ShowMessage (s); // ZH-CN ...
end ;

end .