DeepL plugin usage in C# programs

Hi,

in my company, we use SDL Trados Studio 2017 SR1 (Version 14.1.10011.20356)  in combination with the DeepL plugin. With the version 3.0 of this plugin, not all segments were translated. Version 1.9 seems to work in SDL Studio. But, I was unable to use it for a pretranslate task in C#, what was still possible with version 3.0 and the described errors like in SDL Trados Studio: 

 

FileBasedProject fileP = new FileBasedProject(@"path and file name of the project");
ISettingsBundle settings = fileP.GetSettings();

#region pretranslate settings

ISettingsBundle settings = fileP.GetSettings();
TranslateTaskSettings preTranslateSettings = settings.GetSettingsGroup<TranslateTaskSettings>();
preTranslateSettings.ConfirmAfterApplyingExactMatch.Value = true;
preTranslateSettings.ConfirmAfterApplyingInContextExactMatch.Value = true;
preTranslateSettings.CreateReport.Value = true;
preTranslateSettings.LockContextMatchSegments.Value = false;
preTranslateSettings.LockExactMatchSegments.Value = false;
preTranslateSettings.MinimumMatchScore.Value = 100;
preTranslateSettings.NoTranslationMemoryMatchFoundAction.Value = NoTranslationMemoryMatchFoundAction.ApplyAutomatedTranslation;
preTranslateSettings.OverwritePerfectMatch.Value = true;
preTranslateSettings.TranslationOverwriteMode.Value = TranslationUpdateMode.OverwriteExistingTranslation;

fileP.UpdateSettings(fileP.GetTargetLanguageFiles()[0].Language, settings);

#endregion

 

var originalUri = new Uri("deepltranslationprovider:///");

TranslationProviderConfiguration config = fileP.GetTranslationProviderConfiguration();
TranslationProviderCascadeEntry tpce = new TranslationProviderCascadeEntry
            (
                  new TranslationProviderReference(originalUri), false, true, true, 0
            );

config.Entries.Add(tpce);
fileP.Credentials.AddCredential(originalUri, "api key");
fileP.UpdateTranslationProviderConfiguration(config);

 //pretranslate only the file with index 2 

AutomaticTask analyzeTask = fileP.RunAutomaticTask(
                new Guid[] { fileP.GetTargetLanguageFiles()[2].Id },
                AutomaticTaskTemplateIds.PreTranslateFiles);

The segments of the target sdlxliff file were unfortunately not filled. They were only stored as "draft". Please help me that my program is working.

Another problem are large files. I tested with an 1 MB file. In both versions 1.9 and 3.0 they need a lot of time to be processed. It would be nice if the plugin could be modified to work faster.  

 

Many regards,
Andreas Meisel