Evaluating: problem with loading SIB at runtime

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
scoman81
Posts: 2
Joined: Mon Mar 12, 2007 10:40 pm

Evaluating: problem with loading SIB at runtime

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

Post 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.
Best regards,
Igor Siticov.
scoman81
Posts: 2
Joined: Mon Mar 12, 2007 10:40 pm

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