Frequently Asked Questions

For translating database grids just add all fields to the respective data-set and use TsiLang "DisplayLabels" property to translate display label for each field. In the grid "Columns" property do not set "Title" sub-property it will be overwritten by field's "DisplayLabel" property. Or you can translate them using Collections property of TsiLang.

Just use the same technique as for CONST section and change keyword RESOURCESTRING to CONST.

The following declaration of string constant:

const
  constname =
  'stringvariable';
should be changed to:
const
  constname = 'stringvariable';

For translating InfoPower's DBGrid component: just use  the "Multilines" property of TsiLang and translate the grid's "Selected" property.

Note: Be careful with this property translation, be sure to keep the format and places of the tabulation TAB character.

Just use the TsiLangs ExtendedTranslations property. This property will help you to translate any other property not handled by TsiLang directly.

You can insert into the source the following tags: {TSI:IGNORE}, {TSI:IGNORE ON},{TSI:IGNORE OFF}, {TSI:IGNORE NEXT} and {TSI:IGNORE VALUE} to inform TsiLang Expert that these lines or code blocks should be skipped for translation. Please check the User Guide and help file for the detailed description of these tags.

Just use the respective methods of TsiLang components. All standard dialog box functions like MessageDlg(), ShowMessage(), InputBox() are re-implemented in TsiLang to provide internationalization support.

This could happen only of if you use older versions of the OS and IDE. You might need to install Japanese (or any other non-Western) locale support and/or set your system's default locale to Japanese. To do that go to Control Panel|Regional Options|General tab. Make sure the check box related to your locale is checked, then hit the Set Default button to set the related locale as system's default. 

Also please check the following article: https://www.tsilang.com/support-for-unicode-languages/

We recommend the following workaround:

  • Declare a new function for loading strings from the resources, for example:
extern PACKAGE AnsiString __fastcall LoadStr2(int Ident)
{
  TResStringRec ResRec;
  ResRec.module = (long *) &HInstance;
  ResRec.ident = Ident;
  return (LoadResString(&ResRec));
}
  • Replace LoadtStr() calls to LoadStr2() calls in all of your units.
  • Compile your application.

  • Run TsiLang Resource Strings Import Wizard (available from TsiLang Expert's Tools|Wizards menu) and import all strings from your executable that need to be translated.

  • All these strings (selected in wizard) will be imported into TsiLang and will be available for translation.

  • Enter the translations for these strings and re-build the project.

Usually every TActionClientItem is linked to a corresponding TAction which provides string data for its clients. TsiLang components maintain Action's string properties such as Caption or Hint, so all visual controls linked to the Action are updated when the active language is changed.

However, those TActionClientItems that are not linked with any action, for example top-level items of TActionMainMenuBar, have no published string properties and cannot be handled directly. For such TActionClientItems we would recommend the following trick:

  1. For every TActionClientItem without a TAction create a "fake" Action and link them. For example, if your TActionMainMenuBar has a top-level menu item 'File', create a new action FileFile1, set its .Caption property to 'File', and link them.
  2. Enter translation data for this Action in the Translation Editor.
  3. If an action has no event handler it is permanently disabled, so set the OnUpdate event handler of all "fake" actions to the procedure like this:
    procedure TForm1.FakeActionUpdate(Sender: TObject);
    begin
      TAction(Sender).Enabled := True;
    end;
    

A demo project for this case could be downloaded from https://www.sicomponents.com/soft/ActionManager.zip

If you are using data structures like the below:

const
  str1 = 'My String constant 1';
  str2 = 'My String constant 2';
  str3 = 'My String constant 3';
  StrArr: array[0..2] of string = (str1, str2, str3);

You need to replace the StrArr declaration with the following one:

StrArr: array[0..2] of PString = (@str1, @str2, @str3);

Also, all the references in the code to the array's elements like

...StrArr[Index]...

must be replaced with:

...StrArr[Index]^...

Unfortunately, there is no an easy way to do this. But may be you can hack this by writing something like this in the OnShow event of for example TsiFindDialog:

procedure TForm1.siFindDialog1Show(Sender: TObject);
var
  hnd: THandle;
  R: TRect;
begin
  with siFindDialog1 do
  begin
    if (siLang = nil) or (siLang.Language <> 'Dutch') then 
      Exit;
    GetWindowRect(Handle, R);
    SetWindowPos(Handle, 0, 0, 0, R.Right - R.Left + 26, R.Bottom - R.Top, SWP_NOMOVE or SWP_NOZORDER);
    hnd := GetDlgItem(Handle, 1);
    SetWindowPos(hnd, 0, 0, 0, 100, 23, SWP_NOMOVE or SWP_NOZORDER);
    hnd := GetDlgItem(Handle, IDCANCEL);
    SetWindowPos(hnd, 0, 0, 0, 100, 23, SWP_NOMOVE or SWP_NOZORDER);
  end;
end;

Yes, you can use TsiLang components in IntraWeb applications in the same way as in usual VCL/FMX applications. The demo project could be downloaded from http://www.sicomponents.com/soft/IW_SiLang.zip

The same applies for any other web framework library, like UniGUI and others. You can check the video sample of UniGUI application translated with TsiLang components on our Videos page.

Yes, although this requires some tricks to be done. Please find the details in our forum post...

There are two possible cases:

  • 3rd party forms use resource strings for visible UI elements:

Just use the Resource Strings Import Wizard to import the used resource strings into the TsiLang component. In order to be able to control 3rd party forms' Font and Charset used to display under each language you can use the TScreen.OnActiveFormChange event. For example:

 

TForm1 = class(TForm)  {…}    
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure OnFormChange(Sender: TObject);
{…}
end
;
{…}

procedure
TForm1.FormCreate(Sender: TObject);
begin

Screen.OnActiveFormChange := OnFormChange;
end
;
procedure
TForm1.OnFormChange(Sender: TObject);
begin

if (Screen.ActiveForm <> nil) and (Screen.ActiveForm <> Self) then
Screen.ActiveForm.Font.Assign(Self.Font);
end
;
  • 3rd party forms use hard-coded strings for UI elements:

You will have to place TsiLang on each 3rd party form, add this form to your project and translate it as it would be a usual form from your project.

There is a small bug (or as designed) in the TDBNavigator component. To fix it you may use the following sample code:

procedure TForm1.FormCreate(Sender: TObject);
begin
  DBNavigator1.Hints.CommaText := 
  siLang1.GetStringValue(@siLang1.MultiLines,
  'DBNavigator1.Hints', siLang1.ActiveLanguage);
end;

When an XP Theme enabled the Developer Express components convert AnsiString to WideString using the application default locale. You can fix this by changing application's thread locale on language changing event. For example:

procedure TForm1.siLang1ChangeLanguage(Sender: TObject);
begin
  if siLang1.ActiveLanguage = 1 then
    SetThreadLocale(LANG_ENGLISH)
  else
    SetThreadLocale(LANG_JAPANESE);
end;

SysLocale global variable could be used in the later versions of the Delphi and C++Builder:

procedure TForm1.FormCreate(Sender: TObject);
begin
  if SysLocale.PriLangID = LANG_ENGLISH then
    siLangDispatcher1.ActiveLanguage := 1
  else if SysLocale.PriLangID = LANG_GERMAN then
    siLangDispatcher1.ActiveLanguage := 2
  else if SysLocale.PriLangID = LANG_FRENCH then
    siLangDispatcher1.ActiveLanguage := 3
  else
    siLangDispatcher1.ActiveLanguage := 1;
end;

Also you can use the WinAPI to detect the OS's default language:

procedure TForm1.FormCreate(Sender: TObject);
var
  LangID: DWORD; 
begin
  LangID := GetUserDefaultLangID; 
  case Byte(LangID and $03FF) of 
    LANG_ENGLISH: siLangDispatcher1.ActiveLanguage := 1; 
    LANG_GERMAN: siLangDispatcher1.ActiveLanguage := 2; 
    LANG_FRENCH: siLangDispatcher1.ActiveLanguage := 3; 
  else
    siLangDispatcher1.ActiveLanguage := 1;
end;

Or you may consider reading this useful article "Creating Multilanguage Applications Translated by Users".

Sometimes, under the Windows XP with themes enabled the main menu's background becomes white after changing the languages. This is known as the XP bug and as workaround could be used as follows:

  1. Set Images property to nil before switching language.
  2. Switch active language.
  3. Restore the value of Images property.

The following Delphi code demonstrates this:

  MainMenu1.Images := nil; 
  siLangDispatcher.ActiveLanguage := (computed value); 
  MainMenu1.Images := ImageList1; 

It looks like you don't have all the update and service packs installed into Delphi 6. Please install all the available service and update packs (including RTLUpdate 3) because TsiLang package was compiled with all the latest packs installed.

This was the price to have a single packages for Delphi and C++Builder. If you use only the C++Builder you can fix this by adding {$DEFINE BCB} at the first line of SI.INC file and re-build the TsiLang packages. If you need to use both Delphi and C++Builder or you don't have Full Source edition, or you don't want to re-build TsiLang packages then you will need to set siLang_Def_UsedInCpp global variable declared in siComp.hpp to true in your C++ projects right after the Application->Initialize(); call.

Compiled units (DCU) are provided ONLY for the Win32, Win64, Android, Linux and OSX platforms. iOS DCUs are generated for iOSSimulator target. So if you need to build your projects for iOS target platform you will need to re-build your project using the sources of the TsiLang Components Suite units.

FMX global conditional define is required to build TsiLang units under FireMonkey projects. If you just link pre-compiled TsiLang units to your FireMonkey project this define is not required.

If you get a crash during installing of the registered version of the TsiLang Components Suite on the Windows Server platform, please turn OFF the Data Execution Prevention (DEP) OS's setting. DEP is ON by default on the Windows Server platforms and this may cause a crash during the install.

You need just to assign the FileName property of the dispatcher component and call LoadAllFromFile() method:

procedure TForm1.FormCreate(Sender: TObject);
begin
  siLangDispatcher1.FileName := "YourSILorSIBFileName.SIL";
  siLangDispatcher1.LoadAllFromFile(siLangDispatcher1.FileName);
end;

To translate TsiLang Components Suite just add your language to the tsilang_translations.sib file and specify the filename in the Custom file field under TsiLang Expert Language Options.

A step by step guide on how to add a language to the SIB file can be found here: Translate software with SIL Editor: A Step-by-Step Guide

Copyright © 1998-2024 Igor Siticov, SiComponents. TsiLang®, Resource Builder® and SiComponents® are registered trademarks of Igor Siticov.
RAD Studio, Delphi and C++Builder are trademarks and/or registered trademarks of Embarcadero Technologies, Inc.

Follow us: