ImageEn, unit hyiedefs

LanguageToStr

LanguageToStr


Declaration


function LanguageToStr(ALanguage : TMsgLanguage) : string;


Description


Converts a TMsgLanguage to string, e.g. msEnglish would return 'English', msItalian returns 'Italian', etc.


Example


// Create all language menu items
procedure TMainForm.CreateLanguageMenuItems;
var
  aLang : TMsgLanguage;
  NewItem: TMenuItem;
begin
  mnuLanguage.Clear;
  for aLang := Low(TMsgLanguage) to High(TMsgLanguage) do
  begin
    NewItem := TMenuItem.Create(Self);
    NewItem.Caption := LanguageToStr(aLang);
    NewItem.Checked := IEGlobalSettings.MsgLanguage = aLang;
    NewItem.Tag := ord(aLang);
    NewItem.OnClick := LanguageClick;
    mnuLanguage.Add(NewItem)
  end;
end;
        
// Handle clicking of a language item
procedure TMainForm.LanguageClick(Sender: TObject);
var
  aLang : TMsgLanguage;
  I: Integer;
begin
  for I := 0 to mnuLanguage.Count - 1 do
    mnuLanguage.Items[I].Checked := False;
  aLang := TMsgLanguage(TMenuItem(Sender).Tag);
  IEGlobalSettings.MsgLanguage := aLang;
  TMenuItem(Sender).Checked := True;
end;


See Also


- Language Support
- MsgLanguage