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
TsiLang does not function anymore if I call LoadAllFromFile
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.
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.
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:
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.
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;