I have a FileBasedProject with :
- Language pair: "de-DE" to "en-GB".
- One file "fruits.xml".
- One DeepL MT Translation Provider.
Attempting to run the following code via the API completes without errors but does not pre-translate the file (no translations in the target segment):
FileBasedProject ThisSdlProject = new FileBasedProject(SdlProjectFilePath);
var settings = ThisSdlProject.GetSettings();
var preTranslateSettings = settings.GetSettingsGroup();
preTranslateSettings.NoTranslationMemoryMatchFoundAction.Value = NoTranslationMemoryMatchFoundAction.ApplyAutomatedTranslation;
preTranslateSettings.TranslationOverwriteMode.Value = TranslationUpdateMode.KeepExistingTranslation;
preTranslateSettings.MinimumMatchScore.Value = 75;
ThisSdlProject.UpdateSettings(settings);
ProjectFile[] translatableFiles = ThisSdlProject.GetTargetLanguageFiles(new Core.Globalization.Language(CultureInfo.GetCultureInfo(TargetLocale)));
AutomaticTask preTranslateTask = ThisSdlProject.RunAutomaticTask(
translatableFiles.GetIds(),
AutomaticTaskTemplateIds.PreTranslateFiles
);
ThisSdlProject.Save();
However, if I select the file in Studio 2021, Batch Tasks -> Pre-translate -> Finish (without changing any settings), it works:
I swapped the DeepL MT Translation Provider for a File Based Translation Provider (Test_de-DE_en-GB.sdltm) and tried it again, and it worked as expected:
Are there additional settings that must be applied in order for MT Translation Provider pre-translation to be applied via the API?
Thanks in advance,
Samuel
Generated Image Alt-Text
[edited by: RWS Community AI at 6:37 AM (GMT 0) on 15 Nov 2024]
Translate
