Hi
I need to translate my program into another language.
And I have decided to do it like this:
I have a file lang.txt which is structred as first line English text and second line is another language:
Options
Opicions
This works OK.
First I started with function that searches for string and returns string from next line:
Label1.Caption:=GetTranslation('Options');
Now I would like to change this to a procedure where I would pass a control and it procedure would change it's 'Caption' property. Something like:
TranslateControl(Label1);
and procedure would be:
procedure TranslateControl(Control:TObject);
begin
TObject(Control).Caption:=GetTranslation(TObject(Control).Caption);
end;
This doesn't work...
Any suggestions how can I do this?
There are Labels, Buttons and CheckBoxes to translate, so they all have Caption property.
I could use
TButton(Control).Caption:=GetTranslation(TButton(Control).Caption);
or
TLable(Control).Caption:=GetTranslation(TLabel(Control).Caption);
But how can I identify what kind of control is it?
thanx
end;
I need to translate my program into another language.
And I have decided to do it like this:
I have a file lang.txt which is structred as first line English text and second line is another language:
Options
Opicions
This works OK.
First I started with function that searches for string and returns string from next line:
Label1.Caption:=GetTranslation('Options');
Now I would like to change this to a procedure where I would pass a control and it procedure would change it's 'Caption' property. Something like:
TranslateControl(Label1);
and procedure would be:
procedure TranslateControl(Control:TObject);
begin
TObject(Control).Caption:=GetTranslation(TObject(Control).Caption);
end;
This doesn't work...
Any suggestions how can I do this?
There are Labels, Buttons and CheckBoxes to translate, so they all have Caption property.
I could use
TButton(Control).Caption:=GetTranslation(TButton(Control).Caption);
or
TLable(Control).Caption:=GetTranslation(TLabel(Control).Caption);
But how can I identify what kind of control is it?
thanx
end;