Problems using MT Enhanced through SDL Project Automation API, works in Studio.

I am creating an external .NET application that uses a Project Template to setup a project, add files from a directory, attach a TM, and then use the MT Enhanced plugin. The Pre-translate Files task is configured so that when no match is found, "Apply automated translation". When we create a New Project and run the Pre-Translate Batch Task through Studio (we are on 2015), it works perfectly. We can see what the TM did and also what the MT did. However, when I try to do it in my application, I am received an error:

{"Unexpected exception when initializing task 'Analyze Files': Authentication failed for translation provider 'mtenhancedprovider:///?sendplaintextonly=False&selectedprovider=Microsoft+Translator&usecatid=False&catid=65c5ca74-d991-4f3f-9374-224861807990-en-US-es-MX-TMX-CUSTOM&resenddrafts=False&usepreedit=False&usepostedit=False&prelookupfilename=&postlookupfilename='.."}

Is there an additional setting that is needed when attempting to use the MT Enhance programmatically? Or will it only work when the task is executed via Studio?

Parents Reply Children
  • Ciao Jeff,

    ref: Regarding adding the provider in the template, this is the part you are referring to right? Still learning the terminology with Studio so I want to make sure I understand correctly :) 

    Yep exactly. The template should already have the mt cascade entries, therefore no need to re-add it.  strange that the credentials are not picked up in this case.  I have also just tried here and also didn't work for me.

    Screenshot of Trados Studio XML code with highlighted sections indicating the mt cascade entries in the template.

     

    My next step would be to concentrate on reviewing the mt provider and identify how we can improve/update it so that it works correctly in your workflow.

    P.



    Generated Image Alt-Text
    [edited by: Trados AI at 1:17 PM (GMT 0) on 5 Mar 2024]
  • When I add the MT manually (using the Uri and API key), I get a Success message returned but when I attempt to open the Project then check on the language pair settings, it errors saying the translation provider could not be opened and has been disabled.

    It does seem like reviewing the mt provider is the way to go. Hopefully it can work where we have different MT categories at the individual language pair level instead of at the All Language Pair level. Thank you for all the help and guidance!
  • Hi Patrick,

    I was reading this topic with interest because I've to manage the same problem.

    Do you have any info about this issue?

    thanks in advance

    Luca

  • Is there any solution for this problem? 

    <CascadeEntryItem PerformConcordanceSearch="false" Penalty="0" PerformUpdate="false" PerformNormalSearch="true">
          <MainTranslationProviderItem Uri="mtenhancedprovider:///?sendplaintextonly=False&selectedprovider=Microsoft+Translator&usecatid=False&catid=&resenddrafts=False&usepreedit=False&usepostedit=False&prelookupfilename=&postlookupfilename=" State="{"LanguagesSupported":{}}" Enabled="true" />
        </CascadeEntryItem>

    error message:

    Unexpected exception when initializing task 'Analyze Files': Failed to create an instance of translation provider 'mtenhancedprovider:///?selectedprovider=Microsoft+Translator&sendplaintextonly=False&usecatid=False&catid=&resenddrafts=False&usepreedit=False&usepostedit=False&prelookupfilename=&postlookupfilename='..

    code: 

                    Uri uri = new Uri("mtenhancedprovider:///?sendplaintextonly=False&selectedprovider=Microsoft+Translator&usecatid=False&catid=&resenddrafts=False&usepreedit=False&usepostedit=False&prelookupfilename=&postlookupfilename=");    
                    string credential = "API-KEY";
                    string state = "{"LanguagesSupported":{}}";
                    
                     private static void AddMTTranslationProvider(FileBasedProject project, Uri uri, string credential, string state)
     {
         TranslationProviderConfiguration tpConfig = project.GetTranslationProviderConfiguration();
    
         //tpConfig.Entries.Clear(); 
    
         tpConfig.Entries.Add
         (
             new TranslationProviderCascadeEntry
             (
                 new TranslationProviderReference(uri, state, true), false, true, false, 0
             )
         );
    
         project.UpdateTranslationProviderConfiguration(tpConfig);
    
         project.Credentials.AddCredential(uri, credential);
    
         ISettingsBundle settings = project.GetSettings();
         TranslationMemorySettings tmSettings = settings.GetSettingsGroup<TranslationMemorySettings>();
         project.UpdateSettings(settings);