Using Custom Logic to Update a Remote TM

You can call the <SendTmUpdatePipeline> pipeline to send out updates to a remote TM (translation memory) of selected items and versions for which the translated versions were updated.

To call this pipeline:
  1. Create an instance of ClayTablet.SC.Pipelines.SendTmUpdatePipelineArgs class to pass to the pipeline as an argument. The SendTmUpdatePipelineArgs class is defined in ClayTablet.SC.dll as:

public class SendTmUpdatePipelineArgs : PipelineArgs

{

public String SourceLanguage { get; set; }

public String TargetLanguage { get; set; }

public void AddTmUpdateItem(string itemId, int sourceVersion, int targetVersion);

public List&lt;TmUpdateItem&gt; TmUpdateItems { get; }

}

  1. In SendTmUpdatePipelineArgs, specify the following information:
Information Description
ItemId The Sitecore item ID of each updated item to send to the remote TM.
SourceLanguage The source language of the updated items to send to the remote TM.
TargetLanguage The target language of the updated items to send to the remote TM.
AddTmUpdateItem Call this one or more times to add a set of ItemId/SourceVersion/TargetVersion to the list.
SourceVersion The source-language version of the updated items to send to the remote TM.
TargetVersion The target-language version of the updated items to send to the remote TM.

Note: Invoking the pipeline once can update the remote TM for multiple Sitecore items with the same source and target languages.

  1. Invoke the pipeline to send the specified Sitecore items with the same source and target languages to update the remote TM.

  2. Use the SendTmUpdatePipelineArgs.TmUpdateItems class to verify that an item has actually been sent out to update a remote TM. class is defined in ClayTablet.SC.dll as:

public class TmUpdateItem

{

public string ItemId { get; }

public int SourceVersion { get; }

public int TargetVersion { get; i}

public int TargetVersionUsedForTmUpdate { get; }

public bool Updated { get; }

}

You specify the following information:

Information Description
ItemId The Sitecore item ID of each updated item to send to the remote TM.
SourceVersion The source-language version of the updated items to send to the remote TM.
TargetVersion The target-language version of the updated items to send to the remote TM.
TargetVersionUsedForTmUpdate The version of the updated target items to send to the remote TM.
  1. Inspect the TmUpdateItem.Updated property to verify that an item has actually been sent out to update a remote TM.

  2. If an item was not actually sent out to update a remote TM, investigate the following possible reasons:

  • The target version was not updated after the translation was received.
  • The Connector did not find a translation record associated for the Sitecore item ID and the specified source and target version combination.
  1. If neither of the reasons in the previous step is relevant, then check the Clay Tablet and Sitecore log files to determine whether any unexpected errors occurred during the TM update process.

  2. To verify which target version was sent to update the remote TM, inspect the TmUpdateItem.TargetVersionUsedForTmUpdate property. Typically the Connector uses the target version specified in the arguments to update the remote TM.

However, if the Always Update TM using latest target version check box is selected in the /sitecore/system/Settings/Lionbridge Settings/Lionbridge Connector Settings item, Update TM section, the pipeline uses the latest target version instead of the specified target version, and TmUpdateItem.TargetVersionUsedForTmUpdate returns that version number. If the Connector does not send out item to update a remote TM, then TmUpdateItem.TargetVersionUsedForTmUpdate is not specified.

Note: When you use the pipeline to send out multiple items to update a remote TM, then the Connector groups the items in the same way that it grouped the original items for translation in an XML file. Items that were originally in the same XML file (asset task file) are sent out in the same TM update file.

Sample code for calling the pipeline:

SendTmUpdatePipelineArgs pArgs = new SendTmUpdatePipelineArgs();

pArgs.SourceLanguage = _itemSourceLanguageName;

pArgs.TargetLanguage = _itemTargetLanguageName;

pArgs.AddTmUpdateItem(_itemID, _itemSourceVersion, _itemTargetVersion);

CorePipeline.Run(“SendTmUpdatePipeline”, pArgs);

int tmUpdatedCount = 0;

foreach (TmUpdateItem updateItem in pArgs.TmUpdateItems)

{

if (updateItem.Updated)

{

    tmUpdatedCount++;

}

}