Demanded Translation Request

If you want to encourage your users to make the translation into some language, which is not yet in your app, add a so-called demanded translation into your LangsHelper account.

For our demo Sample Program, the demanded translation to Korean is already added. You may view the demanded translation by logging into the demo account and visiting this page. You may ensure that the demanded translation for Sample Program to Korean is added:



Now if the user of the Sample Program works on a Korean system, they will get the offer to participate in the program’s translation to Korean. Let us see how this works.

We need to run Sample Program and emulate that the system language is Korean by choosing this language in the drop-down list:



Now if we close the program, we will get the dialog window like this:



If you do not see this window, try to reset the demo program’s data by pressing the Reset the data button at the bottom of the window.

The role of the library is not only to show this window if the system language matches one of the demanded translations’ languages. It also increments the counter of shows in your LangsHelper account. So you may control how many times the offer to make the translation has been shown.

This can be done on the same page as shown in the picture above. See the Requests column. (To open this link you need to log into the demo account.)

To show the translation offer window, if applicable to the current situation, we use the below code called before the program close:

// OccurredEvent – is the last event received after working the CheckForEvent function:
const TTranslationsEvent_DemandedTranslation *DemandedTranslationEvent =
  dynamic_cast <const TTranslationsEvent_DemandedTranslation*> (OccurredEvent.get());
if (DemandedTranslationEvent)	{
  TranslationsSiteInteraction->ShowTheDemandedTranslationOfferIfNeeded (
    DemandedTranslationEvent,
    LocalizedStrings[31]	// "Would you like to help translate this program into %s?"
    );
  }
					
var
  DemandedTranslationEvent: TTranslationsEvent_DemandedTranslation;
...
// OccurredEvent – is the last event received after working the CheckForEvent function:
if(OccurredEvent is TTranslationsEvent_DemandedTranslation) then
  begin
    DemandedTranslationEvent :=
      OccurredEvent as TTranslationsEvent_DemandedTranslation;
    TranslationsSiteInteraction.ShowTheDemandedTranslationOfferIfNeeded (
      DemandedTranslationEvent,
      LocalizedStrings[31]	// "Would you like to help translate this program into %s?"
      );
  end;
					

Thus, we are checking whether the last event’s class received from CheckForEvent is derived from TTranslationsEvent_DemandedTranslation and if so, performing the type cast and calling the ShowTheDemandedTranslationOfferIfNeeded member function.

If the user chose OK in the above window, your account’s page for the translators will be opened and scrolled to the part which refers to the demanded translations:



If the user clicked Cancel instead, the demanded translation offer will never show for him again. If you clicked this button in the demo application and want the offer to be shown again, click the Reset the data button at the bottom of the window.