TsiLang and form inheritance / run-time issue

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
Paul Zip
Posts: 20
Joined: Wed Jul 26, 2006 2:58 pm

TsiLang and form inheritance / run-time issue

Post by Paul Zip »

Why is it that to allow a form to be translated, the siLang component needs to have streamed TranslationData to the DFM? Why can't there be a run-time option for situations where translation is only being done at run-time? The design time option means whenever any change is made to a form, I have to make sure the siLang component is re-opened and saved, which means it isn't very extensible. I believe this is a weakness in the siLang components. The problem is even worse when working with form inheritance :

I have a project with 2000 forms. I have a base form frmBase with siLangRT on it, I have a descendent form frmTranslateBase which sets siLangRT.IsInheritedOwner to true so that all other forms inherit from this, (our applications were designed this way because it make re-use and propagation of changes far easier). We only have one language - English - in the dispatcher at design time because we dynamically add languages at run time read from a table in our database, this keeps things flexible, allows our apps to be used in non-multi-lingual situations and keeps DFMs smaller. Where appropriate, our users will perform the translation of our apps at run-time, and their translations are saved to SIB files; these get loaded by the individual forms.

At design time, if I open the siLang component on a descendent form I see the list of strings that will be translated, but as we only have one language, our default which is English, I don't want to make any changes. The problem is, if I don't make a change, no translation data is streamed to the DFM, and therefore I can't translate the form : when I invoke the language editor at runtime all I see is ancestor's data e.g frmBase

With the current implementation of siLang, to enable translation of each of the 2000 forms and 100s of datamodules it seems I may be forced to open each in turn and make a change to something in the siLang component. If so, this would be an impossibly huge task and poor design for form inherited applications.

My company purchased ten licenses of your product believing it to be the best solution on the market, but on attempting to implement it into our products it seems we have hit a major show-stopping stumbling block! Can you offer any suggestions?
isiticov
Site Admin
Posts: 2416
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hello,

Just run TsiLang Expert. Select in the list all your forms and click in menu File | Update Translations. This will build the list of translations for all selected forms inside TsiLang components. This will take few seconds for you to perform.
Please let me know if this helps.
Best regards,
Igor Siticov.
Paul Zip
Posts: 20
Joined: Wed Jul 26, 2006 2:58 pm

Post by Paul Zip »

I tried your suggestion, but nothing was streamed to the DFMs.
Paul Zip
Posts: 20
Joined: Wed Jul 26, 2006 2:58 pm

Post by Paul Zip »

Sorry, ignore last post. The DFM data was streamed after I clicked the Save in the IDE.
isiticov
Site Admin
Posts: 2416
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Glad to see it works for you. :)
Best regards,
Igor Siticov.
Paul Zip
Posts: 20
Joined: Wed Jul 26, 2006 2:58 pm

Post by Paul Zip »

I'm sorry, I spoke too soon, this is still a problem with form inheritance. The "Update translations" only seems to work if the inherited siLang component exists in a descendent's DFM. i.e. Something has changed which differs from its ancestor. This would still mean somehow causing a change in over 2000 forms, so this is still a MAJOR problem for us :(

Any other ideas?
isiticov
Site Admin
Posts: 2416
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

The problem is that forms to update must be open in IDE before using Update Translations. You can either open them manually or wait few hours as we're finalizing the "micro" update release which will fix this issue as well (expert will open and close the forms itself when using Update Translations).
Best regards,
Igor Siticov.
Paul Zip
Posts: 20
Joined: Wed Jul 26, 2006 2:58 pm

Post by Paul Zip »

I've tried "Update Translations" with a particular form open and it still doesn't stream TranslationData unless the DFM contains an inherited reference to the siLangRT - i.e. siLangRT has changed in some way to its ancestor.

So I still have a big hurdle to circumvent.

Do you have any other suggestions as deadlines are looming?
Paul Zip
Posts: 20
Joined: Wed Jul 26, 2006 2:58 pm

Post by Paul Zip »

In fact, I've caused siLangRT to be streamed to DFM by moving it (Left property changed) on descendent form, but this still won't cause TranslationData to be streamed if I use "Update Translations". I think the problem somehow relates to NeedWriteTranslation sub procedure in TsiCustomLang.DefineProperties. It would be good to have some Option which tells it to return True regardless, then the TranslationData should be streamed.
isiticov
Site Admin
Posts: 2416
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

If you can see TranslationData entry in DFM then it was streamed.
The steps to fix the problem now on your side:
1. Open your project.
2. Open TsiLang Expert.
3. Select your forms in the list.
Important!!!
If any of the inherited form is listed with 0 as languages count (this means DFM doesn't contain any info about inherited TsiLang).
3.1. Select these forms; right-click on them and select View Form (this will just open them in IDE).
3.2. Re-scan project by pressing CTRL+L or clicking on TsiLang Expert menu item under Tools Delphi menu.
3.3. This must let expert to know that these forms are translated.
4. Select all forms you need to update.
5. Select in Expert's File menu Update Translations.
This will stream translation data into DFM.
Please let me know if this helps.
Best regards,
Igor Siticov.
Paul Zip
Posts: 20
Joined: Wed Jul 26, 2006 2:58 pm

Post by Paul Zip »

I've followed your instructions exactly and TranslationData is still not being streamed. As I said, I suspect the problem relates to NeedWriteTranslation sub procedure in TsiCustomLang.DefineProperties. I think it would be good to add something to TsiCustomLang.Options e.g. loAlwaysStreamTranslationData which could be set. This could then be checked in NeedWriteTranslation and would make it return true.

It is worth mentioning that in our project there can be multiple levels of form inheritance, could this be the source of the problem? :

frmBase <- frmTranslateBase <- frmDatabase <- frmRoadTax

frmRoadTax streamed no data even though it does have labels, checkboxes and group boxes to translate.
isiticov
Site Admin
Posts: 2416
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

We've tried to reproduce this and used the same level of inheritance. But form on the "frmRoadTax" level was streamed and Translation Data contains new components. Does TsiLang Expert shows at lest 1 near the frmRoadTax in the list? Will it stream the data if you right-click on TsiLang on frmRoadTax and select Update Translations?
Actually, NeedWriteTranslation just checks if the internal translations are equal to ascendant translations. So the problem is that TsiLang on your frmRoadTax doesn't update it's Translation Data as it should. Or do you mean that in your project frmRoadTax contains NO new components compared to frmDatabase?
Best regards,
Igor Siticov.
Paul Zip
Posts: 20
Joined: Wed Jul 26, 2006 2:58 pm

Post by Paul Zip »

Yes there is a 1 in the against the form in the expert. It does seem to stream the data if you right click on the component on the form, but not if you do it from the expert form.
isiticov
Site Admin
Posts: 2416
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Could you please send me privately your registered email address and I will send you the sources with the fix to see if it will work in your case?
Best regards,
Igor Siticov.
Post Reply