Trados 2022 SR1 Api Automatic Task (Pre-translation) failure: Unexpected exception when configuring file multiFileConverter for task 'Pre-translate Files': Failed to create an instance of translation provider.

I am able to successfully PreTranslateFiles using a file-based TM using SDK API Trados 2022 17.0.0.11594.

namespace Sdl.Sdk.PreTranslateFiles
{
    using System;
    using Sdl.Core.Globalization.LanguageRegistry;
    using Sdl.ProjectAutomation.Core;
    using Sdl.ProjectAutomation.FileBased;
    public class PreTranslateFiles
    {
        public void Create(
            string SdlProjectFilepath,
            string SdlTargetLanguage
        )
        {
            FileBasedProject ThisSdlProjectObject = new FileBasedProject(SdlProjectFilepath);
            this.RunAutomaticTask(ThisSdlProjectObject, SdlTargetLanguage);
            ThisSdlProjectObject.Save(); 
        }
        private void RunAutomaticTask(FileBasedProject ThisSdlProject, string TargetLanguageCode)
        {
            ProjectFile[] targetFiles = ThisSdlProject.GetTargetLanguageFiles(LanguageRegistryApi.Instance.GetLanguage(TargetLanguageCode));
            AutomaticTask preTranslate = ThisSdlProject.RunAutomaticTask(targetFiles.GetIds(), AutomaticTaskTemplateIds.PreTranslateFiles);
        }
    }
}

However, when using SDK API Trados 2022 SR1 17.1.6.16252, although other AutomaticTasks (ConvertToTranslatableFormat, CopyToTargetLanguages), the PreTranslateFiles fails.

Checking the SDLPROJ file (Tasks), I can see the error:

Unexpected exception when configuring file multiFileConverter for task 'Pre-translate Files': Failed to create an instance of translation provider.

I have checked that the TM is uplifted/re-indexed, and also tried a different TM, however it still fails with the same error.

Can anyone offer any troubleshooting tips?

Thanks



title edited
[edited by: Samuel Baldus at 1:22 PM (GMT 1) on 11 Jul 2023]
emoji
  • Hi  ,  thx for sharing your code and being available for a sync/meeting yesterday to align/demonstrate these issues.

    Here are my latest findings after reviewing this issue.

    1. Processing automation tasks are successful after adding the binding redirects to the app.config; you also confirmed this.
    2. The reason you are seeing the additional Info messages in the console output is because you have choosen to receive and write to std output (console) the processing messages from your app.config. If don't need these, then simply remove the implementation of Log4Net from your project.
    3. I confirm that the Info messages that are written to std output do not interfere with the automation tasks themselves + they are not written to the project file.  I suspect that the messages that you are seeing in the project file are from an automation execution prior to updating the app.Config file with the binding redirects?
      Note: If you look/check from you screenshots above, the error messages that are written in the project file are different to info processing messages that are written to console output.

    Can you please check/confirm again with a new project.  If the issue persists, we can schedule another sync/meeting.

    emoji
  • Hi  

    Thanks for the meeting, and the replies.

    1. Agreed, and confirmed.
    2. Updating the app.config with the removal of the log4net implementation does remove the errors in the console.
    3. After (2), nothing is written to the .sdlproj file.

    Prior to the change, albeit they were not the same as the ones displayed in the console, errors were written to the .sdlproj file.

    I don't really understand the cause, but the solutions you've offered have allowed our projects to progress, which we really appreciate.

    Thanks again, and hope to catch up with you in the near future. 

    emoji