How to add language weaver cloud by code in trados studio project creation

Hi Team,

I am new come to RWS.

For now, I am working on a automation project about the Trados Studio and I want to realize file auto pre-translate with MT(Language Weaver Cloud Provider).

But after searching from trados studio API book, I found there is only examples for beglobal and gooleTM sample, and I didn't know how to add Language Weaver Cloud Provider with the code, do we have some samples for this?

Do we have the API url and Key or other connect function for this.

You can refer to the googleTM function as below with C#:

 

public void AddGoogleMT(FileBasedProject project, string apiKey)
{
    Uri GoogleUri = new Uri("googlemt://");

    TranslationProviderConfiguration tmConfig = project.GetTranslationProviderConfiguration();

    tmConfig.Entries.Add
    (
        new TranslationProviderCascadeEntry
        (
            new TranslationProviderReference(GoogleUri), false, true, true, 0
        )
    );

    //Add the Google Api key. To get an Api Key you will need to sign up with Google for the 
    //Google Translate API V2 service.
    project.Credentials.AddCredential(GoogleUri, apiKey);

    project.UpdateTranslationProviderConfiguration(tmConfig);
}

I have checked the Language Weaver APIs and it use HTTP request for realize the translate and it is not what i want.

What I want is only add Language Weaver Cloud Provider when a creat a new project.

Do we have a sample or demo for this?

Screenshot of Trados Studio API documentation page showing code example for adding BeGlobal Community Machine Translation Provider.

Hope for you response.

Best Regards,

Ethan



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

    I have included a sample project here that will help you undestand better how to add a translation provider to your project.  The uri scheme for language weaver, is as follows:

    var uri = new Uri("sdlmtcloud:///"),

    Example:

    private static void AddTranslationProvider(FileBasedProject project)
    {
      var tpUriString = "sdlmtcloud:///";
     
      var tpReference = new TranslationProviderReference(new Uri(tpUriString), null, true);
      var tpCascadeEntry = new TranslationProviderCascadeEntry(tpReference, true, true, false);
     
      var tpConfig = project.GetTranslationProviderConfiguration();
      tpConfig.Entries.Add(tpCascadeEntry);
      project.UpdateTranslationProviderConfiguration(tpConfig);
     
      project.Credentials.AddCredential(new Uri(tpUriString), false, "username", "password");
      project.Save();
    }

    emoji
Reply
  • Hi  ,

    I have included a sample project here that will help you undestand better how to add a translation provider to your project.  The uri scheme for language weaver, is as follows:

    var uri = new Uri("sdlmtcloud:///"),

    Example:

    private static void AddTranslationProvider(FileBasedProject project)
    {
      var tpUriString = "sdlmtcloud:///";
     
      var tpReference = new TranslationProviderReference(new Uri(tpUriString), null, true);
      var tpCascadeEntry = new TranslationProviderCascadeEntry(tpReference, true, true, false);
     
      var tpConfig = project.GetTranslationProviderConfiguration();
      tpConfig.Entries.Add(tpCascadeEntry);
      project.UpdateTranslationProviderConfiguration(tpConfig);
     
      project.Credentials.AddCredential(new Uri(tpUriString), false, "username", "password");
      project.Save();
    }

    emoji
Children
No Data