Sdl Sdk Project Automation Use Template and PreTranslateFiles using Server Based Translation Memories

How is it possible to run AutomaticTask.PreTranslateFiles, using server based Translation Memories?

MainTranslationProviderItem Uri="sdltm.gsdemo.gs.sdlproducts.com/ Global Solution Consultants%2FBC Translation Productivity%2FSDL EMEA LSP%2FSDL LSP Trials%2F{CompanyName}&tmName={TmName}" Enabled="true
private void RunAutomaticTask(FileBasedProject ThisSdlProject, string TargetLanguageCode){
    ProjectFile[] targetFiles = ThisSdlProject.GetTargetLanguageFiles(new Language(CultureInfo.GetCultureInfo(TargetLanguageCode)));
    AutomaticTask preTranslate = ThisSdlProject.RunAutomaticTask(targetFiles.GetIds(), AutomaticTaskTemplateIds.PreTranslateFiles);
}

I get the error: "The current parameters are not compatible with the Translation Provider Uri Schema"

Parents
  • Hi,

    The format of the Uri is wrong and you shouldn't create it manually. 

    I've created a code sample here in which you'll see how to properly create a TranslationProviderCascadeEntry containig a serverTM reference and adding it to a project.

    Best regards,

    Emanuel

  • Hi Emanuel,

    I didn't create the Uri manually, the example in my post is what is exactly in the Sdl Project Template file.

    So I don't want to add a server Tm as it is already defined within the template.

    I am currently getting errors when using the template that already contains references to server Tms.

    Is it just a case then of adding the server credentials?..:

    project.Credentials.AddCredential(new Uri(serverAddress),
    	$"user={username};password={password};type={(useWindowsSecurity ? "WindowsUser" : "CustomUser")}");
    project.UpdateTranslationProviderConfiguration(config);

    Thanks for your advice

  • If it would be a credential problem, Studio would just hang... I tested this by creating a template which had a serverTM set and programatically running a pretranslate. It doesn't throw any exceptions, just hangs.

    By the way, here's another post of a user who had the same issue and fixed it (maybe it'll work for you too)

    From the error that you said you get, "the current parameters are not compatible with the Translation Provider Uri Schema", it would seem like the URI is not in the correct format (and it's not, if I look at other URIs in templates/projects I can see clear differences from the URI you provided). That's why I thought that maybe you've tried to write it manually and suggested that you should use the classes provided by the API to form it. 

    Can you provide the template you used?

    How did you create it?

    What version of Studio?

    Was it done programatically?

  • The SdlTemplate was created within "Trados Studio 2019 SR2 15.2.5.2145"; from project; and adding a server-based translation memory. So it is studio that is adding this to the template, not me.

    Either way, from Andrea's suggestion, I was able to create a project from the template and am no longer getting the Uri schema error.

    But I am still not able to programmatically pre-translate using the template/server Tm.

    My reply above shows my current code and the error that appears in the SDLProj file -> Reports:

    <Messages Level="Error" Message="Unexpected exception when configuring file multiFileConverter for task 'Pre-translate Files': Failed to create an instance of translation provider 'sdltm.gsdemo.gs.sdlproducts.com/ Global Solution Consultants%2FBC Translation Productivity%2FSDL EMEA LSP%2FSDL LSP Trials%2F{COMPANY}&amp;tmName=Fruits TM'.." Source="Pre-translate Files">

    Any thoughts?

    Thanks

  • Ok, good. Can you provide me the template?

    I tried to reproduce the issue but I cannot... for me everything works as it should. 

    You can send it to my work mail, ealbu@sdl.com

Reply Children
No Data