ImageEn

Language Support


ImageEn provides full localization for twenty-five languages: Arabic, Chinese (Simplified and Traditional), Czech, Danish, Dutch, English, Farsi, Finnish, French, German, Greek, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Russian, Serbian, Slovenian, Spanish, Swedish and Turkish (Note: machine translation has been used for some localization).



To support localization, you must add the ielang32.dll (for 32bit EXEs) or ielang64.dll (for 64bit EXEs) to your application exe folder (See ImageEn DLL info).

These languages are used in ImageEn dialogs (such as when editing and printing images) and by ImageEn Actions. Changing the current language requires only setting IEGlobalSettings().MsgLanguage, although the default is msSystem so it should automatically display the correct language for the user. To test the localization, try the demos in the \Actions\ folder.

You can check the coverage for specific languages by reviewing iewords.pas. If you update any of the translated strings, please email your changes to support@xequte.com.

If you do not require localization support, you can undefine specific languages in in "ie.inc" to reduce the size of your EXE. You will need to recompile your packages.

Note: Some languages that use extended character sets, such as msRussian, msChinese, msChineseTraditional, msJapanese, msArabic, msKorean, require a Unicode compatible Delphi/C++ version (2009 or newer)


Examples

// Set language to Italian
IEGlobalSettings().MsgLanguage := msItalian;

// Change language to Italian and show warning if ielang32.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;

// Use ImageEn to localize your buttons
btnOK.Caption := IEGlobalSettings().GetLanguageWord( IEMSG_OK );
btnCancel.Caption := IEGlobalSettings().GetLanguageWord( IEMSG_Cancel );

// Customize ImageEn's translation
IEGlobalSettings().SetLanguageWord( msEnglish, IEMSG_OK, 'Yeah, dude!' );
IEGlobalSettings().SetLanguageWord( msEnglish, IEMSG_Cancel, 'Nah...' );
IEGlobalSettings().UpdateLanguage();


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

- MsgLanguage
- GetLanguages
- GetLanguageWord
- SetLanguageWord
- UpdateLanguage
- LanguageToStr
- iewords.pas file