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