SiComponents Home Page SiComponents Forums
Here you will be able to get help and share your experience
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Extracting strings from a TsiLangLinked

 
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite
View previous topic :: View next topic  
Author Message
clauer



Joined: 04 Dec 2002
Posts: 2

PostPosted: Wed Dec 04, 2002 10:30 pm    Post subject: Extracting strings from a TsiLangLinked Reply with quote

Hi,

I'd like to build action bars (menu and tools) at run time. To do this I must know the names of the actions. As long as I use one language, this is easy to achieve, using more than one language, extracting the from TsiLangLinked strings in the language selected would be more convenient.

So I tried 'itemName := lngUStart.OtherStrings.Values[actDBFirst.Category]' but nothing was returned. The name 'actDBFirst.Category' can be found in 'Other strings' using Translation editor - Other.

With 'lngUStart.OtherStrings.GetText' (or .CommaText or .DelimitedText) I get all entries in 'Other strings' but I only want exactly one which has to be in the language choosen.

'itemName := lngUStart.OtherStrings.ValueFromIndex[index]', which returns all translations of an entry including its name with the first letter cut off, would be no good choice because the index may vary while the name of an entry doesn't.

The same applies to 'Captions'.

How can I get the correct language entry as a string from 'Captions' and 'Other'?

Thanks for your help!
Christian Lauer
Back to top
View user's profile Send private message
gaivans



Joined: 29 Nov 2002
Posts: 71

PostPosted: Thu Dec 05, 2002 8:32 am    Post subject: Extracting string value Reply with quote

Hello,

You can use the method:
function TsiCustomLang.GetStringValue(AStrings: pStrings; AName: TString; ALang: integer): TString;
where AStrings is the pointer to strings data (@Captions, @Hints, etc), AName is a string identifier, and ALang is the number of language to be extracted.

For example, after execution
...
with lngUStart do
itemName := GetStringValue(@OtherStrings, 'actDBFirst.Category', 2);
...
the itemName should contain translation of "actDBFirst.Category" for the language #2.

If you want to extract translation corresponding to the active language you can also use the .GetTextFrom method. For example:
...
with lngUStart do
itemName :=GetTextFrom(@OtherStrings, 'actDBFirst.Category', False);
...
Note, if the last parameter is False, this method returns empty string if no translation available.

Best regards,
Serghei Gaivan
Back to top
View user's profile Send private message AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    SiComponents Forums Forum Index -> TsiLang Components Suite All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by p h p B B  © 2001, 2005 p h p B B  Group