Page 1 of 1

Best practice for multi package projects

Posted: Wed Dec 23, 2020 9:44 pm
by RMeneghini
Hello,

I have an application (C++) that is composed of multiple packages (BPL). Is there a recommended way to use the TsiLang components for this scenario? Should each package have its own data module (TsiLang, TsiLangLinked & TsiLandDispatcher)? Or, is there a way to just use the TsiLangLinked in the packages and connect them to the main application?

Kind regards,

Roberto

Re: Best practice for multi package projects

Posted: Thu Dec 24, 2020 4:23 am
by isiticov
Hello,
You can try to use only TsiLangLinked in packages and assign CommonContainer and Dispatcher properties upon package initialization. Something like the following:
1. In a package declare 2 global variables for holding reference to TsiLang and TsiLangDispatcher from the main application.
2. In OnCreate event of every form in a package assign the CommonContainer and LangDispatcher properties of TsiLangLinked to these variables.
3. In a package add some "initialization" function that accepts references for TsiLang and TsiLangDispatcher and assigns them to the variables from step 1. And call this function from the main application when package is loaded passing dispatcher and TsiLang references from the main application.
Hope this helps.

We will try to create sample project for such case.

Re: Best practice for multi package projects

Posted: Mon Jan 04, 2021 10:48 pm
by RMeneghini
Hello Igor,
Thank you for the prompt response. I think I'm able to follow the logic. I just have some more doubts:
1- Do the languages need to be configured in every package at designing time? I could not find a way to connect siLangLinked in each BPL to the siLangDispatcher in the main program in the IDE.
2- The siLangDispatcher has a property "FileName" that, if I'm correct, indicates the file where to store the translations. I cannot find a similar field in thesiLangLinked. When I double-clicked on siLangLinked to translate the resources of the package (BPL), which file will be used?

Kind regards,

Roberto

Re: Best practice for multi package projects

Posted: Wed Jan 06, 2021 6:17 am
by isiticov
Hello Roberto,

1 - Yes, although they will be updated at run-time once you assign dispatcher property. But in order to work properly it is recommended to configure languages in BPLs too. You can select all forms in BPL in Expert and configure them at the same time in a bulk.
2. "FileName" property of dispatcher indicates the file from were to load translations. At run-time once TsiLang component gets linked to dispatcher and FileName property is set the dispatcher will try to load this component from the specified file. But initially, translations are stored in DFMs. You can export them to external file and later load from it but only if this is needed.

Re: Best practice for multi package projects

Posted: Wed Jan 06, 2021 4:08 pm
by RMeneghini
Hello Igor,

Once again, thank you for the clear response. One of the main reasons I'm evaluating the SiComponents is to be able to outsource the translation to a third party that does not have the Embarcadero IDE. Should I export all translations to the external file or send the DFMs?

Kind regards,

Roberto

Re: Best practice for multi package projects

Posted: Thu Jan 07, 2021 4:30 am
by isiticov
Hello Roberto,

Yes, in this case you need to export translations to external file, send it to translators and them load it back into DFMs. Saving and loading could be easily performed in TsiLang Expert. No need to send the DFMs.
You can check the following links:
1. https://youtu.be/6R54hJ9FX14 - TsiLang Live Demo: creating multilanguage version of an existing RAD Studio application. There are demonstrated all of the steps.
2. https://www.tsilang.com/create-user-tra ... lications/