Calling Custom Workflow Logic

The Connector can call custom logic when it sends out items for translation and when content returns from translation.

To configure custom logic for when the Connector sends out items for translation:
  1. In the Website_root/Website/App_Config/Include/CT3Translation.config configuration file, add the <CustomSendItemsPipeline> section after the <SendItemPipeline> section to call custom logic after the Connector sends out items for translation. This section can be similar to the following:

<CustomSendItemsPipeline>

<processor type=“Your.Class, Your.Assembly” method=“YourMethod” />

</CustomSendItemsPipeline>

  1. Optional. To send content items for translation that do not require translation or that already have translated content in the local TM (translation memory), use the optional Boolean TriggerForItemsWithoutFieldToTranslate parameter, for example:

<setting name=“ClayTablet.TriggerForItemsWithoutFieldToTranslate” value=“true” />

  • If this parameter is set to true, the Connector triggers the <CustomHandleTranslatedItemPipeline> pipeline for items that do not need require translation as well as for items that require translation.
  • If this parameter is set to false, or if the TriggerForItemsWithoutFieldToTranslate parameter is not present, then the Connector triggers the <CustomHandleTranslatedItemPipeline> pipeline only for items that require translation.
  1. Ensure that the processor method has the following signature:

public void Your.Class.YourMethod (Sitecore.Pipelines.PipelineArgs arg);

  1. You can retrieve the following information from the arg parameter:
Information Description
arg.CustomData[“Database”] (String) The Sitecore database that contains the item sent out for translation.
arg.CustomData[“ItemId”] (String) The identifier of the Sitecore item sent out for translation.
arg.CustomData[“SourceLanguage”] (String) The Sitecore language code of the source language.
arg.CustomData[“SourceVersion”] (int) The version of Sitecore item sent out for translation.
arg.CustomData[“TargetLanguage”] (String) The Sitecore language code of the target language.
arg.CustomData[“TargetVersion”] (int) The target version of the Sitecore item.
arg.CustomData[“JobId”] (String) The identifier of the Clay Tablet job that contains the item sent out for translation.
arg.CustomData[“AssetId”] (String) The identifier of Clay Tablet asset that contains the item sent out for translation. An asset can contain multiple Sitecore items, because the Connector aggregates multiple items into one XML to send out for translation.
To configure custom logic for when the Connector receives translated content:
  1. In the Website_root/Website/App_Config/Include/CT3Translation.config configuration file, add the <CustomHandleTranslatedItemPipeline> (after existing <SendItemPipeline> section to call custom logic after the Connector receives the translated content. This section can be similar to the following:

<CustomHandleTranslatedItemPipeline>

<processor type=“Your.Class2, Your.Assembly” method=“YourMethod2” />

</CustomHandleTranslatedItemPipeline>

  1. Ensure that the processor method has the following signature:

public void Your.Class2.YourMethod2 (Sitecore.Pipelines.PipelineArgs arg);

  1. You can retrieve the following information from the arg parameter:
Information Description
arg.CustomData[“Database”] (String) The Sitecore database that contains the item sent out for translation.
arg.CustomData[“ItemId”] (String) The identifier of the Sitecore item sent out for translation.
arg.CustomData[“TargetLanguage”] (String) The Sitecore language code of the target language.
arg.CustomData[“TargetVersion”] (int) The target version of the Sitecore item.
arg.CustomData[“JobId”] (String) The identifier of the Clay Tablet job that contains the item sent out for translation.
arg.CustomData[“AssetId”] (String) The identifier of Clay Tablet asset that contains the item sent out for translation. An asset can contain multiple Sitecore items, because the Connector aggregates multiple items into one XML to send out for translation.
arg.CustomData[“AssetTaskId”] (String) The identifier of Clay Tablet asset task of the received translation. There is a one-to-many relationship between assets and asset tasks, because one source can be translated into multiple target languages.