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?

  • Hi

    I moved this post to the developer forum as this is the right place for it. Perhaps can help with this question?

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

  • Hi Jeff,

    I have been successful in reproducing the exception that you noted here.  It is not possible to use Sdl.Community.MtEnhancedProvider in the scenario that you have identified, given the latest version of the code.

    Everything that you have done seems to be inline with what I would expect for this type of integration.

    Things to note: the URI should have the same scheme as the Provider (i.e. mtenhancedprovider:///), so that the plugin framework can identify it correctly and similarly adding the credentials with the Uri("mtenhancedprovidermst:///").  

    If you have already added the provider in the template that is used to create the project + the settings (with credentials) being persisted,  then it should work without any additional configuration.  Have you tested that scenario?

    I would suggest to review the Sdl.Community.MtEnhancedProvider solution from Sdl-Community and enhance it to fulfil your requirements, which others might also benefit from in the future.

  • Thanks for your help Patrick. Forgive me if it's a dumb question, but how do I determine the correct Provider scheme? In other words, in Uri("mtenhancedprovidemst:///") how did you know to add the "mst" part?

    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 :) 

     

    Trados Studio screenshot showing the Translation Memory and Automated Translation window with a highlighted section for 'Choose TM provider' dropdown menu.

    If so, yes I have tried this. It works fine within the application, but with the API it doesn't. 

    Thank you for your help and patience!



    Generated Image Alt-Text
    [edited by: Trados AI at 1:17 PM (GMT 0) on 5 Mar 2024]
  • Hi  

    Unknown said:
    how do I determine the correct Provider scheme? In other words, in Uri("mtenhancedprovidemst:///") how did you know to add the "mst" part?

    You can find this in the sourcecode in github that  mentioned.  In this case there are actually two as the plugin is a MicrosoftTranslator (mst) and Google Translate (gt) provider:

    mtenhancedprovidergt:///

    mtenhancedprovidermst:///

    On your other question... Patrick will need to answer that.  But I think what he's suggesting is that you effect a change to the MT plugin code on github before you use it in your own creation so that it can use persistent credential settings.

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

  • Thank you and for your help with this, it is greatly appreciated! I will try these suggestions.
  • 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? 

    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: