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); }
    } }
  • Hi Jesse,

    if i understand correctly, you are applying some kind of filer so that only certain files are processed.
    But if the document is processed, you call the Batch Task "AutomaticTaskTemplateIds.CopyToTargetLanguages" as well.

    The problem is => if you use that CopyToTargetLanguages Batch Task on a document, it will copy the document to ALL target languages and not only to en-US. So i think that it doesnt really solve the problem.

    Regards,
    Mario
Reply Children