CopyToTargetLanguages: How to copy a source document only to specific target languages?

This questions refers to the Batch Task: AutomaticTaskTemplateIds.CopyToTargetLanguages in the Project Automation API.

The batch task copies the given projectFileIds to all target languages.
Is there also a way to copy ProjectFiles only to specific target languages, but not to all target languages?


E.g. if you wanna have a project with the following constellation:


Document A: de => en, fr
Document B: de => en, it
Document C: de => fr, it

Parents
  • Hi Mario,

    I think you can make a custom batch task which does this.

    In the newest SDK, there is a visual studio template for the Batch Task API, once you use that, you can use something like the following code in your custom BatchTask:

    public class CopyToTargetLanguagesCustom : AbstractFileContentProcessingAutomaticTask
    {
      protected override void ConfigureConverter(ProjectFile projectFile, IMultiFileConverter multiFileConverter)
      {
        var targetLanguage = projectFile.GetLanguageDirection().TargetLanguage;
        if (targetLanguage.IsoAbbreviation == "en-US") // This is just an example, I'm not sure what conditions you need to check here
        {
    // It would be faster to compile all the Ids you need into a list and then call this once Project.RunAutomaticTask(new[] { projectFile.Id }, AutomaticTaskTemplateIds.CopyToTargetLanguages); }
    } }
Reply
  • Hi Mario,

    I think you can make a custom batch task which does this.

    In the newest SDK, there is a visual studio template for the Batch Task API, once you use that, you can use something like the following code in your custom BatchTask:

    public class CopyToTargetLanguagesCustom : AbstractFileContentProcessingAutomaticTask
    {
      protected override void ConfigureConverter(ProjectFile projectFile, IMultiFileConverter multiFileConverter)
      {
        var targetLanguage = projectFile.GetLanguageDirection().TargetLanguage;
        if (targetLanguage.IsoAbbreviation == "en-US") // This is just an example, I'm not sure what conditions you need to check here
        {
    // It would be faster to compile all the Ids you need into a list and then call this once Project.RunAutomaticTask(new[] { projectFile.Id }, AutomaticTaskTemplateIds.CopyToTargetLanguages); }
    } }
Children