UseInheritedData

This forum designated to discuss the TsiLang Components Suite.
Post Reply
EdwardBenson
Posts: 2
Joined: Tue Apr 27, 2010 1:03 pm

UseInheritedData

Post by EdwardBenson »

I have a Delphi project with many inherited forms.

I am using TsiLangLinked component on each form, and loading all translations from a single SIB file,

I want my Descendent forms to pick up default translations from their Ancestor form, so I do not have to re-enter all the inherited translations in the SIB file.

In version 6.0.3.1 there is property "UseInheritedData", which suggests it will do exactly what I want. However it does not work. So I have to duplicate every inherited component for every descendent form in the SIB file.

I have downloaded trial 6.5.0.2, and property "UseInheritedData" is missing from the TsiLangLinked component.

How can I pick up the inherited translations on each descendent form?

Many thanks.
Edward Benson.

isiticov
Site Admin
Posts: 2207
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

You can set IsInheritedOwner=True for all TsiLang components on child (inherited) forms and they will try to use as much inherited data as possible.

Jean-Paul Brassard
Posts: 65
Joined: Thu May 08, 2008 7:46 pm

Post by Jean-Paul Brassard »

Hi Edward,

We had the same problem two years ago.

Here is what I remember about that problem in 2008.
When we tried reading from DFM, the inherited strings was read from "inherited" Forms. But when we tried reading from SIB, TsiLang componant was unable to fetch strings from the SIB file of the inherited Forms... But this could be different now with newer versions of TsiLang Suite.

Moreover, here is how we solve that anoing problem.
We developped a small basic Form "SilForm" from which all our other forms inherits from. Within SilForm, we put a small piece of code that scans the inheritance hierarchy of the initialized form. If we find some intermediate layers of inheritance, we read the appropriate SIB file(s) to fetch the strings of the running class(es).

Without doing that, when a "child" Form calls a procedure of one of its "parents", the code of said procedure runs with empty strings, or with a copy of the parent's string that has been added in the child's class.

In the 2008 version of TsiLang, we found that such copy of parents string into all their childs and grand childs was random. Some time TsiLang wizard did add them, sometimes it made no copy... So we removed all those copies and add a piece of code in our SilForm to warn us when such duplicate strings are detected.
Last edited by Jean-Paul Brassard on Fri May 28, 2010 3:06 pm, edited 2 times in total.

EdwardBenson
Posts: 2
Joined: Tue Apr 27, 2010 1:03 pm

Post by EdwardBenson »

Hi Isiticov,

I have downloaded version 6.5.0.2. The translation of inherited components from SIB file does not work for me.

I have created a small test project with 1 ancestor form and 1 descendent form. I have a single SIB file for the project. I have set IsInheritedOwner = True on the TsiLangLinked component on the child (inherited) form. The inherited components are not translated.

Regards,
Edward Benson.

isiticov
Site Admin
Posts: 2207
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hello,

When loading from SIB it is not possible to handle automatically the DFM inheritance as it is "designed" by Delphi. Because the inheritance of DFM works only "on compilation" time. Some users have created a small routine that performs some additional tricks to handle loading of SIB and inherited forms. If I recall correctly there was such post on the forum.

Jean-Paul Brassard
Posts: 65
Joined: Thu May 08, 2008 7:46 pm

Post by Jean-Paul Brassard »


Jean-Paul Brassard
Posts: 65
Joined: Thu May 08, 2008 7:46 pm

Post by Jean-Paul Brassard »

isiticov wrote:...When loading from SIB it is not possible to handle automatically the DFM inheritance as it is "designed" by Delphi. Because the inheritance of DFM works only "on compilation" time. Some users have created a small routine that performs some additional tricks to handle loading of SIB and inherited forms...
As posted earlier, we did create an extension to TsiLang to dynamically load inherited strings.
I did prepare a small demo application, with that extension, to illustrate what happens with and without inheritance corrected by our code.
The source of this demo (with extension) is available for the TsiLang users.
If you are interested, please send me a PM with your name, company and email.

Post Reply