TsiLang does not function anymore if I call LoadAllFromFile

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
ursuletzu
Posts: 10
Joined: Mon Feb 02, 2004 9:43 am

TsiLang does not function anymore if I call LoadAllFromFile

Post by ursuletzu »

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
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

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.
ursuletzu
Posts: 10
Joined: Mon Feb 02, 2004 9:43 am

Post by ursuletzu »

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?
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

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: Select all

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.
ursuletzu
Posts: 10
Joined: Mon Feb 02, 2004 9:43 am

Post by ursuletzu »

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
Post Reply