Board index » delphi » Translating / languages / Captions + Hints.

Translating / languages / Captions + Hints.

Hello everyone.
I'm looking for a way, prefferably a component, that can capture alle the
Caption and Hint strings on a form.
I have come up with the following:

procedure ComponentWrite(form:Tform);
var
   i:integer;
   f:textfile;
   c:tcomponent;
begin
   assignfile(f,'comp.log');
   rewrite(f);
   with form do begin
   for i:=0 to ComponentCount-1
   do begin
     c:=Components[i];
     if (c is TButton) then
     begin
        writeln(f,'TButton':12,'--- ',c.name:20,' = '{,c.caption:20,'
+Hint: '+c.hint});
     end
     else
     if (c is TLabel) then
     begin
        writeln(f,'TLabel':12,'--- ',c.name:20,' = '{,c.caption:20,' +Hint:
'+c.hint});
     end
     else
     if (c is TControl) then
     begin
        writeln(f,'TControl':12,'--- ',c.name:20,' = '{,c.caption:20,'
+Hint: '+c.hint});
     end
     else
     if (c is TForm) then
     begin
        writeln(f,'TForm':12,'--- ',c.name:20,' = '{,c.caption:20,' +Hint:
'+c.hint});
     end
     else
     if (c is TMenuitem) then
     begin
        writeln(f,'TMenuItem':12,'--- ',c.name:20,' = '{,c.caption:20,'
+Hint: '+c.hint});
     end
     else begin
        writeln(f,'Unknown':12,'--- ',c.name:20);
     end;
   end;
   end;
   closefile(f);
end;

- When I call it from a form, eg. ComponentWrite(mainform), it does write
out all the components on the form.
The problem is, that I cannot get the captions and hints out, the way it is
written above.
- Is there a simple and generic way to do this.
PS: I know there are many shareware routines for this, but I would really
like to have my very own rutine with the different languages in a DBASE DB.
Please reply to my address below:

Sincerely  Ren Michael Plambek
bx01...@post6.tele.dk

 

Re:Translating / languages / Captions + Hints.


On Mon, 29 Dec 1997 14:47:10 +0100, "bx01970" <bx01...@post6.tele.dk>
wrote:

Quote
>Hello everyone.
>I'm looking for a way, prefferably a component, that can capture alle the
>Caption and Hint strings on a form.
>I have come up with the following:

[...snipped...]

Quote
>- When I call it from a form, eg. ComponentWrite(mainform), it does write
>out all the components on the form.
>The problem is, that I cannot get the captions and hints out, the way it is
>written above.
>- Is there a simple and generic way to do this.

If it were me, I'd convert the form to text and load it into a
stringlist and parse the lines looking for caption, hint, text ...

I've actually written something very similar that will take a .dfm
file and convert and index all the lines that need translated. If I
can find it, I'll post it, or send it to you. That's IF I can find it!

JE McTaggart

Re:Translating / languages / Captions + Hints.


t...@ria.net skrev i meddelelsen <34abbc67.1955...@news.ruralnet.net>...

Quote
>[...snipped...]
>If it were me, I'd convert the form to text and load it into a
>stringlist and parse the lines looking for caption, hint, text ...

>I've actually written something very similar that will take a .dfm
>file and convert and index all the lines that need translated. If I
>can find it, I'll post it, or send it to you. That's IF I can find it!
>JE McTaggart

Thanks - that would be great! - But doesn't it make it difficult to make
additions or changes later on?

- Also you will have to have several execuables - one for each language. I
would like to have just one execuable and a DB with different languages.

- My idea is to place a component on a form, that scans through the form,
creating in a Dbase DB all the captions, hints, etc. If the caption already
exists, it skips it otherwise it is created in the DB.

What it stores in the DB is the name, caption and hint. When at runtime, the
program is told to switch language, - you can have more languages in the
Dbase DB. - The program will the search through all the names and just
change to the appropriate caption & hint.

Sincerely

Ren Michael Plambek

Re:Translating / languages / Captions + Hints.


You can take a look at an application called "Delphi App' Translator".

Check it out at : http://www.worldnet.net/~cycocrew/delphi/applications.html

JEFF

Other Threads