Contents
With TsiLang and the bundled TsiLang Expert, translating your project becomes as effortless and enjoyable as playing your favorite game.
Installation (Trial Version)
- Close all running instances of RAD Studio, Delphi, or C++ Builder.
- Run TsiLangTrialSetup.exe and follow the instructions.
- Once the installation script is finished, TsiLang Components Suite will be automatically installed into the selected IDE(s).
Installation (Trial Version)
Note: If you have previously installed a trial version of the TsiLang Components Suite, please uninstall it from your PC and ensure that all its files are completely deleted.
- Close all running instances of RAD Studio, Delphi or C++ Builder.
- Run SISETUP.EXE (SIBINARY.EXE in case of DCU-Only Edition) and follow the instructions. The installation script will install source files to destination folder and adjust library path for the selected IDE(s).
- Once the installation script is finished, TsiLang Components Suite will be automatically installed into the selected IDE(s).
Implementing localization / multilanguage support
Note #1: You can watch a detailed demo video at the following URL: https://www.sicomponents.com/video-tsilang-live-demo/
Note #2: The translation example below is a simplified demonstration and is intended for illustrative purposes only.
To implement localization/multilanguage support in your project, follow these steps:
- Open the project you want to translate.
- From the main menu of the IDE, select Tools | TsiLang Expert. (TsiLang Expert is a powerful tool designed to simplify the translation process of your project).
To continue the localization process using TsiLang Expert, please follow these steps:
- In the TsiLang Expert command panel, select Selected | Wizard.
- On the first page of the wizard, click the Next button.
- From the list of forms, select the main form of your project.
- In the combo box on the right, set the type to TsiLang for the main form.
- For all other forms in the list, set the type to TsiLangLinked.
These settings will ensure that the main form and other forms in your project are properly linked with TsiLang for translation purposes.
- In the TsiLang Expert’s translation wizard, on the second page, adjust the settings according to the figure below.
-
Once you have completed the wizard, you can open the Translation Editor in TsiLang Expert by following these steps:
- In TsiLang Expert, locate the form that you want to translate.
- Double-click on the form to open the Translation Editor.
- The Translation Editor will display a list of properties and components that can be translated.
- Select the desired component or property that you want to translate.
- Enter the translation in the appropriate language column.
- Repeat the above steps for all the components and properties you want to translate.
- Save your translations when you’re done.
The Translation Editor provides a convenient interface for managing the translations of your forms.
If you want to exclude certain component properties from being translated, you can simply leave the corresponding language field blank in the Translation Editor. This indicates that the property should remain unchanged and not be translated.
Another way to exclude a component or property from translation is by using the right-click menu in the Translation Editor. Here’s how:
- Locate the component or property that you want to exclude from translation.
- Right-click on the component or property to display the context menu.
- From the popup menu, select the “Exclude” command.
By selecting the “Exclude” command, you indicate that the component or property should be excluded from the translation process. This means that it will not be modified or translated when you perform translations.
This method provides a convenient way to quickly exclude specific components or properties from translation without having to leave the Translation Editor.
Language switching code
To change the active language programmatically you can use ActiveLanguage property of the TsiLangDispatcher. Below is the sample code how it can be done in Delphi:
procedure TMainForm.MenuItemGermanClick(Sender: TObject);
begin
siLangDispatcher1.ActiveLanguage := 2;
end;
procedure TMainForm.MenuItemEnglishClick(Sender: TObject);
begin
siLangDispatcher1.ActiveLanguage := 1;
end;
Translating strings in source code
TsiLang Expert provides a convenient feature to analyze your source file, collect, and translate strings and string constants used in your Delphi project. Here’s how you can use this feature:
- Select form to analyze in the TsiLang Expert list.
- In the TsiLang Expert click on the Strings in Source | With Form option in the command panel.
- TsiLang Expert will scan your source file and collect all the strings and string constants used in your code.
- The collected strings will be displayed and you can skip particular if needed.
- You can then proceed to translate the collected strings by providing the translations in the Translation Editor.
By using the “Strings in Source | With Form” option, TsiLang Expert will analyze your source code and extract the strings automatically, saving you the effort of manually identifying and collecting the strings for translation.
Translating DBGrids
To translate TDBGrids using TsiLang, follow these steps:
- Add the necessary fields in the TDataSet fields editor.
- Select Selected | Translate command in the TsiLang Expert’s commands panel. This will open the Translation Editor.
- In the Translation Editor, locate and select the DisplayLabels node in the translations tree. This node represents the DisplayLabel property of the fields in the TDBGrid.
- Enter the translations for the DisplayLabel property of the corresponding fields.
- After entering the translations, click File | Close Saved in the Translation Editor’s command panel to save the translations and close the Translation Editor.
By following these steps, you will be able to translate the DisplayLabel property of the fields in the TDBGrid using the TsiLang and the Translation Editor.
Additionally, if you prefer to translate grids without adding fields, you can use the Collections property of TsiLang. In this case, you would translate the items of the Columns property of the grid, which represents the column headers and other properties of the grid’s columns.
And finally,
compile your project to generate the multilingual application. With the translations in place, you are now ready to deploy your application and reach new regional markets. By offering your software in multiple languages, you can attract a wider audience and potentially increase your revenue from these new markets. Good luck with your multilingual application!