Page 1 of 1

Get the original caption after translate

Posted: Wed Jul 30, 2003 12:30 pm
by magicang
Hi there,

how can i get the original caption of a button after it have being translate to other language ?

regards,
magic :cry:

Posted: Wed Jul 30, 2003 2:34 pm
by gaivans
Hello,

What do you mean by "it have being translate to other language"? If your TsiLang component has more than one language, then it holds as original captions (Languge #1) as well as translated to other languages ones. You will need just set TsiLang.ActiveLanguage = 1 in design-time and all captions on the form will get their original values.

Posted: Thu Jul 31, 2003 12:23 am
by magicang
Hi there,

thanks for the quick reply.

what i menas is, after tsilang translate the form, i wan to retrieve the original text of my tbutton without set the language back to original language in run time.

regards,
magaic

Posted: Thu Jul 31, 2003 6:51 am
by gaivans
Hello,

You can use in run-time the TsiLang's public method
function GetStringValue(AStrings: pStrings; AName: Tstring; ALang: Integer): Tstring;
where AStrings - pointer to a string list; AName - name of a component or string identifier; ALang - number of language (use 1 for default language).

For example, to extract default caption for Button1 you can use:
...
var
S: string;
...
S := siLang1.GetStringValue(@siLang1.Captions, Button1.Name, 1);
...


or more compactly:
...
with siLang1 do
S := GetStringValue(@Captions, Button1.Name, 1);
...