TTranslationsSiteInteraction Class

Provides the higher-level logic of interacting with the server (in comparison with the TTranslationsSite class) by taking into consideration the state of the current application.

Constructor

Format:

TTranslationsSiteInteraction (TTranslationsSite *TranslationsSite,
  TLocalTranslations *LocalTranslations);
					
constructor Create(TranslationsSite: TTranslationsSite;
  LocalTranslations: TLocalTranslations);
					

Parameters:

CheckForEvent

Checks whether a translations-related event has occurred, for example, the new version of the translation was uploaded to the server. By the word «event», we call here the classes that derived from the TTranslationsEventFunc base class.

Format:

void CheckForEvent (TTranslationsEventFunc EventFunc,
  const TLanguage &DesiredLanguage,
  TStopFunc StopFunc,
  ptrdiff_t CallbackParam);
				
procedure CheckForEvent(EventFunc: TTranslationsEventFunc;
  const DesiredLanguage: TLanguage;
  StopFunc: TStopFunc); overload;
				

Return value: None.

Parameters:

LanguageSwitch

If an event of the type TTranslationsEvent_LanguageSwitchPossible has occurred after calling CheckForEvent, this member function performs the switching to the most suitable language. It asks the users whether they want to switch to the more relevant language and if so, downloads the recommended translation and returns it as a local translation.

Format:

bool LanguageSwitch (
  const TTranslationsEvent_LanguageSwitchPossible *Event,
  TLocalTranslation &LocalTranslation,
  bool AskBeforeDownload,
  bool *UserChoosedToCancel);

				
function LanguageSwitch(
  const Event: TTranslationsEvent_LanguageSwitchPossible;
  var LocalTranslation: TLocalTranslation;
  AskBeforeDownload: Boolean;
  var UserChoosedToCancel: Boolean): Boolean; overload;
				

Return value: True if the recommended translation has been successfully downloaded.

Parameters:

After the recommended translation was successfully downloaded, it must be applied to the user interface, therefore it becomes active and the ApplyTranslationFunc passed to the TLocalTranslations constructor will be called.

ActiveTranslationQualityDialog

If the currently active translation is unofficial and not built-in, and the quality dialog has not yet been shown for the current translation, this shows the dialog window asking the user whether they want to keep this translation or switch to the default one. Depending on what the user chose, it sends the positive or negative rating of this translation to the server.

If the user chooses «no», the default translation is turned on replacing the currently working one.

Format:

bool ActiveTranslationQualityDialog(
  const TActiveTranslationQualityDialogStrings &Strings,
  bool *UserChoosedToCancel,
  TVoidBoolFunction RatingSentFunc,
  ptrdiff_t CallbackParam);
				
function ActiveTranslationQualityDialog(
  const Strings: TActiveTranslationQualityDialogStrings;
  var UserChoosedToCancel: Boolean;
  RatingSentFunc: TVoidBoolFunction): Boolean; overload;
				

Return value: If the user had chosen to stay on the current translation, returns true.

Parameters:

Does not work under the systems prior to Windows Vista and under the Classic theme. In this case returns true.

If no function is passed through the RatingSentFunc parameter, the function will return only after the rating is passed to the site.

IsActiveTranslationQualityDialogCanBeShown

Returns true if the translation quality dialog can be shown using the ActiveTranslationQualityDialog function. If the dialog have been already displayed for the current translation, returns false.

Format:

bool IsActiveTranslationQualityDialogCanBeShown ();
				
function IsActiveTranslationQualityDialogCanBeShown: Boolean;
				

Return value: Boolean value.

Parameters: None.

ShowTheDemandedTranslationOfferIfNeeded

If an event of the type TTranslationsEvent_DemandedTranslation has occurred after calling CheckForEvent, this member function shows, if necessary, the dialog window for the potential translator with the offer to participate in translating the program. If the user states that he is interested, opens the site with the additional information.

Simultaneously registers the show of the demanded translation offer on the site. This will increase the on-site counter, so that you will be able to view how often the offer to translate the program into the specific demanded language has been shown.

If the offer has been already shown to the current user and they had pressed Cancel, does nothing when calling this function next time.

Format:

void ShowTheDemandedTranslationOfferIfNeeded(
  const TTranslationsEvent_DemandedTranslation *Event,
  const UnicodeString &MessageText,
  const TProxyServerSettings &ProxySettings);

				
procedure ShowTheDemandedTranslationOfferIfNeeded(
  const Event: TTranslationsEvent_DemandedTranslation;
  const MessageText: WideString;
  const ProxySettings: TProxyServerSettings
  ); overload;
				

Return value: None.

Parameters:.