TIEGlobalSettings.MsgLanguage
Declaration
property MsgLanguage: TMsgLanguage;
Description
This property sets the language for ImageEn dialogs, messages and actions.
Note:
◼To support localization, you must add the ielang32.dll/ielang64.dll to your application exe folder (See
ImageEn DLL info)
◼The UpdateLanguage method of
IIELanguageUpdatable interface is called whenever MsgLanguage is updated
Default: msSystem
IEGlobalSettings().MsgLanguage := msItalian;
// Change language to Italian and show warning if language dll is not found
IEGlobalSettings().RegisterPlugIns([ iepiLanguages ]);
if not ( iepiLanguages in IEGlobalSettings().ActivePlugIns ) then
ShowMessage( 'IELang32.dll not found. Please reinstall.' )
else
IEGlobalSettings().MsgLanguage := msItalian;
Language Selector Example
// Create a pop up menu to select language
procedure AddLanguagesToMenu(Pop: TPopupMenu; OnClick: TNotifyEvent);
var
langs: TMsgLanguages;
i: Integer;
aLang : TMsgLanguage;
NewItem: TMenuItem;
begin
Pop.Items.Clear;
langs := IEGlobalSettings().GetLanguages();
for i := Low( langs ) to High( langs ) do
begin
aLang := langs[ i ];
NewItem := TMenuItem.Create( Pop.Owner );
NewItem.Caption := LanguageToStr( aLang, True );
NewItem.Hint := format( iemsg( IEMsg_SetLanguageToX ), [ LanguageToStr( aLang , False ) ]);
NewItem.Checked := IEGlobalSettings.MsgLanguage = aLang;
NewItem.Tag := ord(aLang);
NewItem.OnClick := OnClick;
Pop.Items.Add(NewItem);
// Add separator for "Default"
if aLang = msSystem then
begin
NewItem := TMenuItem.Create( Pop.Owner );
NewItem.Caption := '-';
Pop.Items.Add(NewItem);
end;
end;
end;
procedure TfrmMain.LanguageClick(Sender: TObject);
var
aLang : TMsgLanguage;
I: Integer;
begin
for I := 0 to popLanguage.Items.Count - 1 do
popLanguage.Items[I].Checked := False;
aLang := TMsgLanguage(TMenuItem(Sender).Tag);
try
IEGlobalSettings.MsgLanguage := aLang;
TMenuItem(Sender).Checked := True;
except
MessageDlg( 'IELang32.dll not found! Copy it to the EXE folder for localization support.', mtInformation, [ mbOK ], 0 );
end;
end;
procedure TfrmMain.PopupLanguageMenuAtControl(Control: TControl);
begin
if popLanguage.Items.Count = 0 then
AddLanguagesToMenu( popLanguage, LanguageClick );
popLanguage.Popup( Control.ClientOrigin.X, Control.ClientOrigin.Y + Control.Height )
end;
See Also
◼Language Support
◼CurrentMsgLanguage
◼GetLanguages
◼SetLanguageWord
◼GetLanguageWord
◼UpdateLanguage
◼LanguageToStr