Central Control for Large Application

This forum designated to discuss the TsiLang Components Suite.
Post Reply
Kevin
Posts: 2
Joined: Wed Sep 22, 2010 4:40 pm

Central Control for Large Application

Post by Kevin »

Hi,

I have downloaded the latest version and have been trying to figure out how to make the component set work for a large application. I have two primary needs.

First, I need to translate generic terms. For example, I currently might have something like the following for a TLabel caption:

"%Company% Name:"

After construction of the form, I currently process all the Captions and do substitutions. In the above example, the end-user might configure a setting to change the word Company to Organization. Therefore, upon display, the default caption would be "Company Name:" or if the word Company has been renamed, it might read, "Organization Name:". Throughout the application, 200+ forms, there is one method in the ancestor form class that pre-processes all the terminology changes.

The second requirement is to do traditional language changes (english, spanish, japanese, etc). However, because there are 100s of very common terms used throughout the application, I want a central datamodule to process most of the changes. I cannot see how to do this very easily using these components. I did have one idea, which was to have two languages on every form. One called "Default" and the other "Coded." The coded column would have a coded value. When the language is switched to "Coded", it would then call the translation datamodule to process the Code into a translatable term. Using the example above, the "default" value would be "Company Name" and the "coded" value would be "COMPNAME." Then, the translating datamodule would look up "COMPNAME" and use the translated text for "Company Name." Using this example, if there were 100 references throughout the application to "Company Name", it would be automatically changed throughout the application.

Is there another way or suggestion??

Thanks,

Kevin

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

Post by isiticov »

Hello,

I'm not sure if I understood exactly what you wan tto do. But I can suggest the following:
1. You can use "central" translation storage in some datamodule.
2. You can intercept ANY translation change by realizing the TsiInterceptStringChange procedure and assign it to the global variable siInterceptStringChange declared in siComp.pas unit.

Code: Select all

type
  TsiInterceptStringChange = procedure(const AObject: TObject; const PInfo: PPropInfo; var APropValue: string);
AObject - is a TsiLang, which is currently updating any string;
PInfo - is a property to change if any.
APropValue - string value.
You can check what AObject is currently "in process" and the value of the APropValue and decide if you need to get the another translation from another TsiLang (placed in Datamodule for example). You can use GetTranslationByLang() method to get the translations of a value by language.
Hope this helps.
Best regards,
Igor Sitikov.

Kevin
Posts: 2
Joined: Wed Sep 22, 2010 4:40 pm

Post by Kevin »

I guess the main thing I want is a central translation point, rather than form by form. If a user wants to change a common label throughout the application that appears 100+ times, I don't think the user should have to open each form and do a translation for that term. There should be some sort of macro option that is assigned at design time so that a label can be changed throughout the application at runtime with ease.

Thanks,

Kevin
Kevin

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

Post by isiticov »

TsiLang components are designed to perform the translation on "by form" basis. To quick translate repeated terms there is a tool named Dictionary Manager and Auto-Translate feature in Translation Editor. Additionally, you can change your code by creating some unit with an UI initialization routine where you will assign all your controls with needed captions. Later just let TsiLang Expert translate this routine and add these strings into one single TsiLang from any datamodule. Although this will require quite amount of manual work for you.
Best regards,
Igor Sitikov.

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

Post by Jean-Paul Brassard »

Hi Kevin,

To solve similar problems, we did write few pre-processing applications. Those applications read DIX or SIB/SIL files and process all translations in them to perform given tasks.

We also wrote a real time procedure that intercept SIB files reading on the fly. This code could interpret specific directives, such as %xyz or fill a given column with a choosen language.

We also wrote a database layer to interpret translation directives. This layer allows us to translate selected columns of our tables with almost no change in the original DB access code.
Jean-Paul Brassard
Quebec, Canada

Post Reply