1 - Using Custom Logic to Send Out Content for Translation

You can call the <SendTranslationJobPipeline> pipeline to send out content for translation. This enables you to send out translation jobs using your own custom logic.

To call the pipeline:

You create an instance of the ClayTablet.SC.Pipelines.SendTranslationJobPipelineArgs class to pass to the <SendTranslationJobPipeline> pipeline as an argument.

The SendTranslationJobPipelineArgs class is defined in ClayTablet.SC.dll as:

public class SendTranslationJobPipelineArgs : PipelineArgs

{

public string JobName { get; set; }

public string SourceLanguage { get; set; }

public IEnumerable&lt;string&gt; TargetLanguages { get; set; }

public string SitecoreUser { get; set; }

public string TeamProfile { get; set; }

public string UselocalTM { get; set; }

public void AddItemsLatestVersionToTranslation(params string\[\] pathOrIdToItems) {}

public void AddItemsLatestPublishedVersionToTranslation(params string\[\] pathOrIdToItems) {}

public void AddItemVersionToTranslation(string pathOrId, int version) {}

public void SendCopyOnly() {}

public void SendToGenericProvider(string providerName, string jobDescription = "",

DateTime ? dueDate = null. string purchaseOrder = "", bool forQuote = false) {}

String purchaseOrder = "", bool forQuote = false, string serviceName = "") {}

public void SendToFreewayProvider(string providerName, string specialInstructions = "",

DateTime ? dueDate = null. string purchaseOrder = "", bool forQuote = false) {}

public void SetFreewayAnalysisCode(int level, string name, string value) {}

}

After instantiating this class, you perform the following steps:
  1. Specify the following information about the job:
  • job name
  • source language
  • target languages
  1. Add Sitecore items, and specify the source versions of those items to translate. You can choose to translate:
  • the latest version of items
  • the latest published version of items
  • choose a specific version for each item
  1. Specify the translation provider to which the Connector will the send the translation job, and provider-specific job metadata, such as:
  • job description or special instructions
  • due date
  • whether the job requires a quote
  • analysis codes (if the translation provider is Lionbridge Freeway)
  • the Sitecore user account for sending the job should be submitted
  • the team profile to which the job belongs
  • whether or not to use the local TM when sending out the job

The following code examples demonstrate how to send copy-only translation jobs, or how to send out jobs to a generic provider, to Lionbridge Freeway, using the ClayTablet.SC.Pipelines.SendTranslationJobPipelineArgs class:

static public void TestJobSendCopyOnly()

{

SendTranslationJobPipelineArgs args = new SendTranslationJobPipelineArgs();

args.JobName = "TestJobSendCopyOnly";

args.SourceLanguage = "en-US";

args.TargetLanguages = new string\[\] { "fr-FR", "de-DE" };

args.AddItemsLatestVersionToTranslation("path/to/item1", "id-of-item2", "path/to/item3");

args.AddItemsLatestPublishedVersionToTranslation("path/to/item4", "id-of-item5", "path/to/item6");

args.AddItemVersionToTranslation("path/to/item7", 2);

args.SendCopyOnly();

CorePipeline.Run("SendTranslationJobPipeline", args);

}

static public void TestJobSendToGenericProvider()

{

SendTranslationJobPipelineArgs args = new SendTranslationJobPipelineArgs();

args.JobName = "TestJobSendToGenericProvider";

args.SourceLanguage = "en-US";

args.TargetLanguages = new string\[\] { "fr-FR", "de-DE" };

args.AddItemsLatestVersionToTranslation("path/to/item1", "id-of-item2", "path/to/item3");

args.AddItemsLatestPublishedVersionToTranslation("path/to/item4", "id-of-item5", "path/to/item6");

args.AddItemVersionToTranslation("path/to/item7", 2);

args.SendToGenericProvider("MyGenericProvider", "Test job send to generice provider", DateTime.Now.AddDays(7), "PO1234", false);

CorePipeline.Run("SendTranslationJobPipeline", args);

}

static public void TestJobSendToFreewayProvider()

{

SendTranslationJobPipelineArgs args = new SendTranslationJobPipelineArgs();

args.JobName = "TestJobSendToFreewayProvider";

args.SourceLanguage = "en-US";

args.TargetLanguages = new string\[\] { "fr-FR", "de-DE" };

args.AddItemsLatestVersionToTranslation("path/to/item1", "id-of-item2", "path/to/item3");

args.AddItemsLatestPublishedVersionToTranslation("path/to/item4", "id-of-item5", "path/to/item6");

args.AddItemVersionToTranslation("path/to/item7", 2);

args.SendToFreewayProvider("MyFreewayProvider", "Special instructions for Freeway provider", DateTime.Now.AddDays(7), "PO1234", false);

args.SetFreewayAnalysisCode(1, "Region", "North America");

args.SetFreewayAnalysisCode(2, "Department", "Accounting");

args.SetFreewayAnalysisCode(3, "Severity", "Critical");

CorePipeline.Run("SendTranslationJobPipeline", args);

}

2 - 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++;

}

}

3 - 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.

4 - Using Custom Logic to Overwrite the Workflow Target-Language Setting when Automatically Sending Items to the Translation Queue via Workflow

The CustomQueueItemTargetLanguagesPipeline setting in CT3Translation.config enables you to use your own logic to override the target-language assignment when the Connector automatically sends a source to the Translation Queue via workflow.

The following is a sample implementation of the pipeline:

public class TestCustomQueueItemTargetLanguagesPipeline

{

public void Process(QueueItemsTargetLanguagesPipelineArgs args)

{   

    Item item = args.SourceItem;

    if (item.Language.ToString().StartsWith("en"))

    {

        args.TargetLanguages.Add("fr-FR");

        args.TargetLanguages.Add("es-ES");

    }

    else

    {

        args.TargetLanguages.Add("en");

    }

}

}

The previous code sample checks the source item to send to the Translation Queue:

  • If the source language starts with en, then it adds the item to the queue with fr-FR and es-ES as target languages.
  • Otherwise, it adds the item to the queue with en as the target language.

Any implementation should have a method with the signature like:

public void Process(QueueItemsTargetLanguagesPipelineArgs args)

The parameter is of ClayTablet.SC.Pipelines.QueueItemsTargetLanguagesPipelineArgs type:

public class QueueItemsTargetLanguagesPipelineArgs : PipelineArgs

{

public Item SourceItem { get; }

public List&lt;String&gt; TargetLanguages { get; }

}

The implementation can get the SourceItem from the argument, and it can insert target language codes into the TargetLanguages list of the QueueItemsTargetLanguagesPipelineArgs object.

5 - Using Custom Logic to Configure how the Upload Schedule Creates Jobs when Automatically Sending Out Items from the Translation Queue

The CustomAutoSendQueuesPipeline setting in CT3Translation.config enables you to use your own logic to determine how to automatically create jobs from the Translation Queue. It works in conjunction with the Auto Send Queue Items Time setting in the /sitecore/system/Tasks/Schedules/Lionbridge/Upload Schedule/Upload Service Options item, which is described in Configuring the Connector to Send All Items in the Queue for Translation.

The following is a sample implementation of the pipeline:

public class TestCustomAutoSendQueuesPipeline

{

public void Process(AutoSendQueueJobsArgs args)

{

    string frJobId = null;

    string otherJobId = null;

    foreach (TranslationQueueInfo queueItem in args.TranslationQueueItems)

    {

    TranslationJobInfo jobInfo;

    if (queueItem.ItemTargets.Contains("fr-FR"))

    {

        if (frJobId == null)

        {

            jobInfo = args.AddNewJob();

            // Create a separate job for queue items with fr-FR as target languages

            jobInfo.Name = "Auto-sent French job " + DateTime.Now.ToString("MM/dd/yyyy HH:mm");

            jobInfo.Description = "Automatically send fr-FR in a separate job scheduled at " + args.ScheduledSendTime.ToString("MM/dd/yyyy HH:mm");

            jobInfo.DueDate = DateTime.Now.AddMonths(1);

            jobInfo.TeamProfile = queueItem.TeamProfile;

            // Optional. Specify first analysis code,

            jobInfo.AnalysisCodes.Add(new AnalysisCode()

            {

                Level = 1,

                Name = "First\_Analysis\_Name",

                Value = "First\_Analysis\_Value"

            });

            // Optional. Specify second analysis code.

            jobInfo.AnalysisCodes.Add(new AnalysisCode()

            {

                Level = 2,

                Name = "Second\_Analysis\_Name",

                Value = "Second\_Analysis\_Value"

            });

            // Optional. Specify third analysis code.

            jobInfo.AnalysisCodes.Add(new AnalysisCode()

            {

                Level = 3,

                Name = "Third\_Analysis\_Name",

                Value = "Third\_Analysis\_Value"

            });

            // Optional. Specify PO Reference.

            jobInfo.PoReference = "PO\_Reference\_Value";

            // You can also specify a certain LSP account to send the job to

            // jobInfo.SendAccount = "FR LSP";

            frJobId = jobInfo.ID;

        }

        else

        {

            jobInfo = args.GetJob(frJobId);

        }

    }

    else

    {

        if (otherJobId == null)

        {

            // Create a job for all other queued items

            jobInfo = args.AddNewJob();

            // Not specify job meta information, the connector will automatically fill in the information based on AutoSendQueueItems* configurations

            // in CT3Translation.config

            otherJobId = jobInfo.ID;

        }

        else

        {

            jobInfo = args.GetJob(otherJobId);

        }

    }

    // If the queue item's ID is not inserted in a TranslationJobInfo object, the queue item will be skipped and left in the queue

    jobInfo.QueueIdsInTheJob.Add(queueItem.ID);

    }

}

}

The previous code sample checks the queued items and creates a translation job named Auto-sent French job with a timestamp. This job includes all queued items with fr-Fr as one of its target languages. The Connector’s default job contains all other queued items.

This enables you to submit different queued items in different jobs, and you can send each job using a different producer key. This also supports sending different queue items at different times, by leaving out some of the queued items in one invocation of the pipeline and picking them up in a later invocation, using the args,ScheduledSendTime to determine which ones to send or leave out.

Any implementation should have a method with the signature like:

public void Process(AutoSendQueueJobsArgs args)

The parameter is of ClayTablet.SC.Pipelines.AutoSendQueueJobsArgs type:

public class AutoSendQueueJobsArgs : PipelineArgs

{

public List&lt;TranslationQueueInfo&gt; TranslationQueueItems;

public DateTime ScheduledSendTime;

public List&lt;TranslationJobInfo&gt; TranslationJobsToCreate;

public TranslationJobInfo AddNewJob();

public TranslationJobInfo GetJob(string id);

}

Implementation can iterate over TranslationQueueItems to check all the queued items waiting to be sent out. The type of ClayTablet.SC.Pipelines.TranslationQueueInfo provides information about the queued item:

public class TranslationQueueInfo

{

public String ID { get; }

public String ItemID { get; }

public String ItemDatabase { get; }

public String ItemSource { get; }

public int ItemSourceVersion { get; }

public String ItemPath { get; }

public List&lt;String&gt; ItemTargets { get; }

public DateTime CreateTime { get; }

public String SitecoreUser { get; }

}

The implementation should either:

  • Insert each queued item into a ClayTablet.SC.Pipelines.TranslationJobInfo object, which will cause it to be sent out as part of the job.
  • Leave a queued item alone, so it will remain in the Translation Queue for this scheduled automatic sending invocation.

public class TranslationJobInfo

{

public string ID { get; }

public string Name { get; set; }

public string Description { get; set; }

public string SendAccount { get; set; }

public DateTime? DueDate { get; set; }

public string SendUser { get; set; }

public string TeamProfile { get; set; }

public string PoReference { get; set; }

public List&lt;String&gt; QueueIdsInTheJob { get; }

public List&lt;AnalysisCode&gt; AnalysisCodes { get; }

}

public class AnalysisCode

{

public int Level { get; set; }

public string Name { get; set; }

public string Value { get; set; }

}

A new TranslationJobInfo is created by AutoSendQueueJobsArgs.AddNewJob(). The implementation can set the job’s metadata, including name, description, sending account (producer key), sending user (the Sitecore user in the Creator metadata of the job), and due date. Insert the queue item’s ID into TranslationJobInfo.QueueIdsInTheJob. After creating a TranslationJobInfo, the implementation should typically save it or its ID for reuse when iterating over other queued items that should be added into the same job. The AutoSendQueueJobsArgs.GetJob (string) enables the implementation to retrieve a previously created TranslationJobInfo so that it can add more queued items into the same job.

6 - Using Custom Logic to Populate the Translation Queue

You can call the <SendToTranslationQueuePipeline> pipeline to put Sitecore items into the Translation Queue. The items are displayed in the queue only for the Context.User.

Prerequisite:

You must set the Context.User to a user with Sitecore access. This must be the user who will review and send out the queued items. If you do not set the context user, then the default user is sitecore\Anonymous, which prevents the items from being displayed in the queue.

To call the pipeline:

You create an instance of the ClayTablet.SC.Pipelines.SendToTranslationQueuePipelineArgs class to pass to the pipeline as argument.

The SendToTranslationQueuePipelineArgs class is defined in ClayTablet.SC.dll as:

public class SendToTranslationQueuePipelineArgs : PipelineArgs

{

public String SourceLanguage { get; set; }

public String\[\] TargetLanguages { get; set; }

public List&lt;String&gt; ItemIds { get; }

public int ItemsQueued { get; }

}

This class enables you to specify the source language and target languages for the items, and add Sitecore item ID into the ItemIds list. The Connector uses the latest source version of the items. When the Connector sends out content for translation from Translation Queue, it creates new target versions for these items. After calling the pipeline, you can use the ItemsQueued property to check how many Sitecore items are actually added to the Translation Queue.

The following is sample code for calling the pipeline:

static public int SendToTranslationQueue(string sourceLang, string[] targetLangs, string[] itemIds)

{

SendToTranslationQueuePipelineArgs args = new SendToTranslationQueuePipelineArgs();

args.SourceLanguage = sourceLang;

args.TargetLanguages = targetLangs;

args.ItemIds.AddRange(itemIds);

CorePipeline.Run("SendToTranslationQueuePipeline", args);

return args.ItemsQueued;

}

7 - Using Custom Logic to Remove Items from the Translation Queue

You can call the <RemoveFromTranslationQueuePipeLine> pipeline to remove Sitecore items from the Translation Queue. The items are displayed in the queue only for the Context.User.

Prerequisite:

You must set the Context.User to a user with Sitecore access. This must be a user with permission to review and send out the queued items. If you do not set the context user, then the default user is sitecore\Anonymous, which prevents the items from being displayed in the queue.

Identifying the content items to remove

Since the same item may have been added multiple times to the Translation Queue (particularly from the Bulk Translation wizard), the Sitecore item ID (SitecoreID) may identify multiple content items to remove, instead of identifying a single content item to remove.

Recommendation: Use the SourceLanguage, TargetLanguages, or SourceVersion parameters to identify which items with the same Sitecore item ID to remove.

  • If the SourceLanguage or TargetLanguages are null, the pipeline removes items with any value, which means it removes items in all source or target languages.
  • If the SourceVersion is 0 (the default value), the pipeline removes items with any value, which means it removes items for all source versions.
To call the pipeline:
  1. Create an instance of the ClayTablet.SC.Pipelines.RemoveFromTranslationQueuePipeLineArgs class to pass to the pipeline as argument.

The RemoveFromTranslationQueuePipelineArgs class is defined in ClayTablet.SC.dll as:

public class RemoveFromTranslationQueuePipelineArgs : PipelineArgs

{

public List&lt;ItemToRemove&gt; ItemsToRemove { get; set; } = new List&lt;ItemToRemove&gt;();

public int RemovedItems { get; internal set; } = 0;

public int Errors { get; internal set; } = 0;

}

  1. In ItemsToRemove, specify the list of items to remove from the Translation Queue.

The ItemToRemove class is defined as:

public class ItemToRemove

{

public String ID { get; set; }

public String SourceLanguage { get; set; }

public String TargetLanguages { get; set; }

public int SourceVersion { get; set; }

public String ErrorMessage { get; internal set; }

public List&lt;ItemDetails&gt; ItemsDetails { get; internal set; } = new List&lt;ItemDetails&gt;();

public int RemovedItems { get; internal set; } = 0;

public bool HasError { get; internal set; } = false;

}

Parameter Description
SourceLanguage The language code of the source language of the item to remove from the queue. For example, to remove an item whose source language is English, specify en.

Note: If this is null (blank), the pipeline will remove items in all source languages.
TargetLanguages The language code of the target language(s) of the item(s) to remove from the queue. For example:

* To remove an item whose target language is French, specify ‘fr-FR’.
* To remove an item whose target language is French, and an item whose target language is German, specify ‘fr-FR,de-DE’. Use a comma ( , ) as a separator of multiple language codes.

Note: If this is null (blank), the pipeline will remove items in all target languages.
SourceVersion The source-language version of the item(s) to remove from the queue. For example, to remove an item whose source-language version is 1, specify 1.

Note: If this is 0 (the default value), the pipeline will remove all source-language versions of the item.
ErrorMessage Information about any error that occurs when removing items from the queue.
ItemsDetails A detailed list of items removed from the queue.
RemovedItems The number of removed items from the queue with the specified Sitecore ID.
HasError A Boolean value indicating whether an error occurred.
ItemsDetails model with information about removed items, as described below.

The ItemDetails class is defined as:

public class ItemDetails

{

public String SitecoreID { get; internal set; }

public String DatabaseID { get; internal set; }

public String SourceLanguage { get; internal set; }

public String TargetLanguages { get; internal set; }

public String ItemDeadLine { get; internal set; }

public String SiteCoreUser { get; internal set; }

public DateTime CreateTime { get; internal set; }

public int Version { get; internal set; }

public bool IsRemoved { get; internal set; } = false;

}

  1. Invoke the pipeline to remove the specified Sitecore items from the Translation Queue.

  2. Use the IsRemoved property to check how many Sitecore items were removed from the Translation Queue.

The following is sample code for calling the pipeline:

private void RemoveFromQueue(string itemId, string sourceLanguage = null, string targetLanguage = null, int sourceVersion = 0)

{

// Create list of objects to remove.

var args = new RemoveFromTranslationQueuePipelineArgs();

args.ItemsToRemove.Add(new ItemToRemove()

{

    ID = itemId,

    SourceLanguage = sourceLanguage,

    TargetLanguages = targetLanguage,

    SourceVersion = sourceVersion

});

// Invoke pipeline.

CorePipeline.Run("RemoveFromTranslationQueuePipeLine", args);

// Display total number of removed items.

Console.WriteLine($"Removed {args.RemovedItems} items and {args.Errors} errors occurred");

// Get removed items.

var removed = args.ItemsToRemove.First();

// Display any error messages.

if (removed.HasError)

Console.WriteLine($"Error message: {removed.ErrorMessage}");

// Display details about a removed item.

foreach(ItemDetails item in removed.ItemsDetails)

{

    if (item.IsRemoved)

    Console.WriteLine($"Removed translate item from source language: {item.SourceLanguage} to target language: {item.TargetLanguages}");

    else

    Console.WriteLine($"Can not removed translate item from source language: {item.SourceLanguage} to target language: {item.TargetLanguages}");

}

}

8 - Using Custom Logic to Override Default Publishing Behavior

You can use custom logic to override default publishing behavior by:

  • creating a custom class to perform the desired publishing behavior
  • in the Lionbridge Sample Workflow item, pointing to the custom class and the library with the corresponding .DLL file

For example, you can use the Sitecore Publishing Service instead of the native Sitecore Publisher. Alternatively you can modify the levels of child and related items published when using the auto-publish feature. To use this feature, select the Automatically Publish content when it reaches the Final State check box in the sitecore/System/Workflows/Lionbridge Sample Workflow or your designated translation workflow. For detailed instructions, see Configuring the Translation Workflow.

To use custom logic to override default publishing behavior:
  1. Create a custom class to perform the desired publishing behavior.
  2. In the Content Editor, in the content tree, navigate to /sitecore/System/Workflows/Lionbridge Sample Workflow/.
  3. Click the Lionbridge Sample Workflow item to select it and open it in the content area.
  4. Scroll down to the LionbridgeTranslation section.
  5. Scroll down to the Custom Publish Library field.
  6. In the Custom Publish Library field, enter:

path_to_library|full_name_of_class

where:

  • path_to_library is the path to the .DLL file.
  • full_name_of_class is the class name with full namespace.

For example:

ClayTablet.SC|ClayTablet.SC.CustomPublish.TestCustomPublish.

Note: If the Custom Publish Library field is blank, the Connector uses the default publishing behavior.

  1. Click the Save button in the top-left corner to save your changes.