Page 1 of 1

Evaluating: problem with loading SIB at runtime

Posted: Tue Mar 13, 2007 3:41 pm
by scoman81
Hi - I'm evaluating your product for our company, and have run into some problems. So far I like your product best, but the following scenario needs to work for us.

I've created a test project that works as expected so far. It contains a data module which holds the dispatcher and a TsiLang component. Then the main form and the about box both have a TsiLangLinked component, properly pointed at the global dispatcher instance on the data module. When the translation data for each form is stored in the DFM, everything works as expected at runtime.

However, I want to have a runtime .SIB file, so here's what I've done ...

1. Run the Expert, and chose Save/Load Translation, Save Project, and then I save master.sil. I open this file in a text editor, and verify that captions from both forms are listed correctly. So far, so good.

2. Using the same menu item, I change the file type to SIB, and save runtime.sib.

3. Select all forms in the expert, and choose Clear Translations.

4. At this point, I run the app again and verify that nothing happens when I try to change the translation (I have a combo on the main form which does this). So I know translation data has been cleared.

5. I add the following code to the FormCreate of the main form:

S := ExtractFilePath(Application.ExeName) + 'runtime.sib';
LanguagesDM.Dispatcher.LoadAllFromFile(S);


After this, the main form can now change languages, as expected. However, the About box form, which is created dynamically, does *not* reflect language changes any longer.

Can you tell me what I might be doing wrong? I have uploaded this project to a zip file located here:

http://www.flightrealm.com/localization.zip

Thanks!
Dave

Posted: Tue Mar 13, 2007 4:32 pm
by isiticov
Hi,

Method LoadAllFromFile loads only TsiLang which are created at the call time. In order to be sure other forms loaded as well upon creation just set FileName property of Dispatcher. This is described at http://www.tsilang.com/delphiglobalizat ... aq.html#19
Additionally you can use OnLinkToDispatcher event and load every TsiLang "manually" since this event is called when new form is created and TsiLang on it links to dispatcher.
Please let me know if this helps.

Posted: Tue Mar 13, 2007 4:53 pm
by scoman81
Ah yes, thanks. That seems to work. Although, I find that in my test program, I have to do both ... I have to call Load and I also have to set the FileName for any forms created later. (In other words, setting the FileName doesn't affect the form in which that call is made.)

Thanks!