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
Parents Reply
  • Hi , I've been able to reproduce and identify a possible issue with resolving Microsoft.Data.SqlClient, Version=4.1.0.0 with the latest release of Trados Studio SR1 outside of the Studio context (e.g. standalone apps).

    I'll udpate the documentation with some tips on how to deal with these later on.  In the meantime can you please test on your end if adding these binding ridirects to your configuration file resolves the issue?

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
      </startup>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="icu.net" publicKeyToken="416fdd914afa6b66" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-2.7.0.0" newVersion="2.7.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Data.SqlClient" publicKeyToken="23ec7fc2d6eaa4a5" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>
    

    emoji
Children