Page 1 of 1

TsiLang does not function anymore if I call LoadAllFromFile

Posted: Mon Feb 02, 2004 9:47 am
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

Posted: Mon Feb 02, 2004 10:33 am
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.

Posted: Mon Feb 02, 2004 10:37 am
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?

Posted: Mon Feb 02, 2004 11:51 am
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.

Posted: Mon Feb 02, 2004 1:05 pm
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