Creating the Server Interaction Classes

If the user’s system language differs from English and German, which are pre-installed with the Sample Program demo application, then the user may suffer inconvenience due to working with this application in a non-native language. We need to tune up the server integration in order to discover a better translation on the server when (and if) it become available there.

To do this, we need to create the TTranslationsSite instance:

  new TTranslationsSite(AccountNameEdit.GetText(), L"Sample Program")
TranslationsSite := TTranslationsSite.Create(Edit1.Text, 'Sample Program');

We pass the name of our LangHelper account as the 1st parameter and the name of our app as the 2nd. This application must be also added to your LangsHelper account, which is already done with our demo application.

We need to create the instance of one more subject area’s class named TTranslationsSiteInteraction. It just receives the pointers to the two described classes: TLocalTranslations and TTranslationsSite. This class offers the functionality, which takes into account the local translations as well as the remotely available ones.

The main function of this class is CheckForEvent. It checks whether there are events related to working with languages and passes them to the specified function in your code. By the word «event», we call here the classes that derived from the TTranslationsEventFunc base class.

CheckForEvents should be called once every time after running our application. We call it upon showing the main window using the code:

TranslationsSiteInteraction.CheckForEvent (

The main thing in this line of code is passing the EventFunc event handling function to which we will receive the events from the library, if the event will occur.

The second parameter may be suppressed in the production code, as there is a default value for it in the function’s declaration. In our application it is explicitly passed just for demo purposes.

Next step: Getting the Translation to the System Language on the Server