API: Failed to create an instance of translation provider deepltranslationprovider

I am currently using v4.8.25 of the plug-in, and I am still having issues when executing the Analyze and Pre-translate tasks from the API whenever my project template includes a Deepl MT provider. Could you please confirm from which version are this issues fixed?

For Analyze I have the same exception as Tamas above:

Unexpected exception when initializing task 'Analyze Files': Failed to create an instance of translation provider 'deepltranslationprovider:///?formality=Default&sendPlain=False'..

For Pre-translate I have the exception:

Unexpected exception when configuring file multiFileConverter for task 'Pre-translate Files': Failed to create an instance of translation provider 'deepltranslationprovider:///?formality=Default&sendPlain=False'..

My issue seems related to community.rws.com/.../deepl-plugin-crash-when-running-automatic-tasks-programatically

Thank you very much for your valuable support.

Kind regards,

Alejandroi

Parents
  • Hi ,

    Please try the following to identify if the issue can be resolved by including the translation provider programmatically, as opposed to recovering it from the project template

    1. Add the following code in your project automation project
    2. Substitute <api_key> with your valid API Key from DeepL
    3. Use a project template that doesn't have any TM provider saved with it's settings to avoid misinterpreting the results.

    private static void AddTranslationProvider(FileBasedProject project)
    {
           var uri_scheme = "deepltranslationprovider:///";
           var formality = "Default";
           var sendPlain = "False";
           var uri = new Uri($"{uri_scheme}?formality={formality}&sendPlain={sendPlain}");
     
           var tmConfig = project.GetTranslationProviderConfiguration();
           var provider = new TranslationProviderReference(uri, string.Empty, true);
           var entry = new TranslationProviderCascadeEntry(provider, false, true, true, 0);
           tmConfig.Entries.Add(entry);
           project.UpdateTranslationProviderConfiguration(tmConfig);
     
           var credential_uri_scheme = "deepltranslationprovider:///";
           var apiKey = "<api_key>";
           project.Credentials.AddCredential(new Uri(credential_uri_scheme), apiKey);
           project.Save();
    }

    let me know how it goes

Reply
  • Hi ,

    Please try the following to identify if the issue can be resolved by including the translation provider programmatically, as opposed to recovering it from the project template

    1. Add the following code in your project automation project
    2. Substitute <api_key> with your valid API Key from DeepL
    3. Use a project template that doesn't have any TM provider saved with it's settings to avoid misinterpreting the results.

    private static void AddTranslationProvider(FileBasedProject project)
    {
           var uri_scheme = "deepltranslationprovider:///";
           var formality = "Default";
           var sendPlain = "False";
           var uri = new Uri($"{uri_scheme}?formality={formality}&sendPlain={sendPlain}");
     
           var tmConfig = project.GetTranslationProviderConfiguration();
           var provider = new TranslationProviderReference(uri, string.Empty, true);
           var entry = new TranslationProviderCascadeEntry(provider, false, true, true, 0);
           tmConfig.Entries.Add(entry);
           project.UpdateTranslationProviderConfiguration(tmConfig);
     
           var credential_uri_scheme = "deepltranslationprovider:///";
           var apiKey = "<api_key>";
           project.Credentials.AddCredential(new Uri(credential_uri_scheme), apiKey);
           project.Save();
    }

    let me know how it goes

Children
No Data