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 

TsiLang does not function anymore if I call LoadAllFromFile

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



Joined: 02 Feb 2004
Posts: 10

PostPosted: Mon Feb 02, 2004 9:47 am    Post subject: TsiLang does not function anymore if I call LoadAllFromFile Reply with quote

If I call LoadAllFormFile( FileName, True or False) the TsiLang translations do not function anymore. It doesn't matter if the second parameter is false or true.

The SIL file was saved at runtime from the Editor stared by clicking on the TsiLang component!

Can someone explain what is wrong or what is the safe method of loading the translations from a SIL file?

I must be able to change the SIL file at runtime!

Thanx
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Mon Feb 02, 2004 10:33 am    Post subject: Reply with quote

It looks like your SIL file is incorrect or doesn't contain all needed information.

1. To create SIL/SIB file from your project I would recommend to use TsiLang Expert and File|Save/Load... menu
2. To load SIL/SIB file at run-time just either set FileName property of TsiLangDispatcher or set StorageFile property of TsiLangRT (in case it is needed to allow user to modify translations at run-time).
3. Also of course you can use LoadAllFromFile() method.
Back to top
View user's profile Send private message
ursuletzu



Joined: 02 Feb 2004
Posts: 10

PostPosted: Mon Feb 02, 2004 10:37 am    Post subject: Reply with quote

The idea is I wanted to save a SIL File for every form and load it dynamically at runtime.
All my silang comps are llinked to a dispatcher.
So the correct approach would be to load the dispatcher, not the silang components from each form?
Back to top
View user's profile Send private message
isiticov
Site Admin


Joined: 21 Nov 2002
Posts: 2102

PostPosted: Mon Feb 02, 2004 11:51 am    Post subject: Reply with quote

Do you need a separate SIL file for each form? Or one SIL file for all forms from project? You can save all forms into one SIL file and they will "rertieve" only needed info when loading from SIL file.
In case you don't need to allow end-user to change translations at run-time I would recommend the following:
1. Set dispatcher's FileName property to you SIL file
2. Or assign even of TsiLangDispatcher OnLinkToDispatcher to the following code:
Code:
procedure TForm1.siLangDispatcher1LinkToDispatcher(Sender: TObject;
  ASiLang: TsiCustomLang);
begin
 ASiLang.LoadAllFromFile('YOURFILE.SIL', True);
end;


This will make you sure that all run-time and auto-created forms of you project will load translations. And gives you better maintained code.
Back to top
View user's profile Send private message
ursuletzu



Joined: 02 Feb 2004
Posts: 10

PostPosted: Mon Feb 02, 2004 1:05 pm    Post subject: Reply with quote

I have some packages that group forms and data modules and projects that use these packages by inheriting the forms.
I am really interested in a code snippet that shows how to load translations for just one form...

Thanx
Back to top
View user's profile Send private message
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