
The Component TMultiLanguage.

The Use Instruction.

The Component TMultiLanguage is used for translation string and 
list properties of Delphi components. This component can be used 
for translation individual strings. It is necessary to indicate the 
file RegML16 for Delphi 1.0 and RegML32 for Delphi 32 and 3.0 for 
registration the component. 

After the component's appearing in the palette of components it can 
be used in application. Let's create a text application which 
demonstrates the possibilities of the component TMultiLanguage 
together. Let's set up some components on the form and set necessary 
meanings of properties. For example, in our application it is a group 
of components getting in GroupBox (Buttons, Tabulator, ListBox, CheckBox). 
If you need the dynamic changing of the form language than it is necessary 
to foresee how the user will change the form language. For example, menu or 
buttons or other switches. 

After creation the form you can put the component TMultiLanguage on it. 
Settled the component on the convenient place on the form, push the right 
button of the mouse and chose the second item ListComponents in. 
Then transfer the components for translation from left list to right 
(without instructions the components are not added for translation).

In this situation it is convenient to use the following operation: 
transfer the all components to the right part. Then push the button 
NoClass, which transfer back the components, whose classes are indicated 
in INI file MLedit in section [Not translate]. The following lines can 
be part of INI file:
[Help]
FileName=C:\Work\ml97\EDITOR\mleditor.hlp

[MLExeFileName]
MLExeFileName=C:\Work\ml97\EDITOR\Mledit3.exe

[Not translate]
1=TEdit
2=TImage
3=TMultiLanguage

Then it is necessary to create the word vocabulary. It is convenient to 
use the component editor. Push the right button of the mouse on the 
component TMultiLanguage and chose the right item of the menu. If the 
file are not found you will be offered to indicate a way to it (it will 
be saved in INI file). In application MLeditor push the button Languages 
and set necessary languages. Then save the empty vocabulary.

Now set the component's properties connected with language on which the 
form were written. For example, LangMainName:='English ' or 
LangMainNumber:=0. Set the name of file in which the created vocabulary 
is situated.

Now everything is ready for starting the translation. It is realised by 
setting the properties LanguageFormName or LanguageFormNumber - these 
properties are not published (do not confuse with LangMainName or 
LangMainNumber): 

Var
ML: TmultiLanguage;
...
ML.LanguageFormNumber:=0 or ML.LanguageFormName:='English'

It is clear that the formation the dictionary is not simple and there is 
so-called DEBUG  mode for it, which has two variants. The first one forms 
a file MLDebug.log without your participation during the first translation. 
The second asks you about the translation of  every unknown words. It is 
necessary to specify -MLDEBUG or -MLDEBUGDLG in a command line for using 
DEBUG  modes. Then it is necessary to lift a file MLDebug.log as textual 
and to keep it in a file of the dictionary.  It is necessary to start the 
component's editor,  press the button to load as the text or  choose the 
appropriate item of the menu, and then to keep Save. By this it is 
necessary to know, that in a textual file MLDebug.log it will be created 
the special comments facilitating translation, such as a name of object, 
its class, translated property and number, if the property is a list. 
With the load of the dictionary as a text, the remarks are defined as 
languages. It is necessary to start the form for change of the languages 
for making the remarks as comments (key F4 or button Languages) and to 
change language, by making it as a  comment.

	Now, when the application is translating it is possible to notice, 
that not all the components were translated.  It happened  because these 
components were not registered for translation by the component 
TMultiLanguage. It is necessary to call for a procedure of registration 
for registration  of the component:

Procedure RegisterLangType (clsInstance: TClass;
Const MasProperty: Array of String);

For example:

Procedure RegisterLangType (TTabbedNotebbok), Pages');

There is the list of the components registered by default  and their 
properties: 

TForm, 			 'Caption', 'Hint'
{Standard}
TMenuItem, 		 'Caption', 'Hint'
TLabel, 		 'Caption', 'Hint'
TMemo, 			 'Hint', "Lines"
TButton, 		 'Caption', 'Hint'
TCheckBox, 		 'Caption', 'Hint'
TRadioButton, 		 'Caption', 'Hint'
TListBox, 		 "Items" ,'Hint '
TComboBox, 		 'Caption', 'Hint', "Items"
TGroupBox, 		 'Caption', 'Hint'
TRadioGroup, 		 'Caption', 'Hint', "Items"
TPanel, 		 'Caption', 'Hint'
{Additional}
TBitbtn, 		 'Caption', 'Hint'
TSpeedButton, 		 'Caption', 'Hint'
TStringGrid, 		 'Hint'
TDrawGrid, 		 'Hint'
TImage, 		 'Hint'
TScrollBox, 		 'Hint'
{Dialogs}
TSaveDialog, 		 'Hint', 'Title', 'Filter'
TOpenDialog, 		 'Hint', 'Title', 'Filter'
{Owners}
TControl, 		 'Caption', 'Hint'

	You can write down the component once again with  the change 
of translated properties, and the translation will be carried out with 
these changes. Let's note, that the translation of the component is 
carried out  by  a  tree of hierarchy: if, for example the property 
Caption is registered at a class TControl, it will be translated at 
it's descendants, if this property is not redefined at them. 

It is also convenient to use events of the component. For example, the 
event happens after the translation to a language:

 TLangEventAfter = procedure (Sender: TObject; var lng,
    NewLng: TLanguage) of object;

 Good luck with translation of the application!
