SDK API Pre-translate task randomly skips file

Good morning,

We have noticed an issue with the SDK API Pre-translate automatic task.

Our SDL Trados Project contains three files (apfel.xml, banane.xml, kirsche.xml) and two file-based translation memories.

We then want to pre-translate all three via the SDK API automatic task, which is called via Windows CMD prompt.

We can run the pre-translate task in two ways, one where we specify the target language; and another where we specify the file GUIDs to apply the task to.

Method 01:

ProjectFile[] targetFiles = ThisSdlProject.GetTargetLanguageFiles(LanguageRegistryApi.Instance.GetLanguage(TargetLanguageCode));
AutomaticTask preTranslate = ThisSdlProject.RunAutomaticTask(targetFiles.GetIds(), AutomaticTaskTemplateIds.PreTranslateFiles);
AutomaticTask populateProjectMemory = ThisSdlProject.RunAutomaticTask(targetFiles.GetIds(), AutomaticTaskTemplateIds.PopulateProjectTranslationMemories);

Method 02:

string[] TargetFileGuidArray = ProvidedTargetFileGuids.Split(',');
Guid[] TargetFileGuids = new Guid[TargetFileGuidArray.Length];
for (int i = 0; i < TargetFileGuidArray.Length; i++){
    TargetFileGuids[i] = new Guid(TargetFileGuidArray[i]);
}
var targetFiles = studioProject.GetFiles(TargetFileGuids);
studioProject.RunAutomaticTasks(targetFiles.GetIds(), new[] { AutomaticTaskTemplateIds.PreTranslateFiles });
studioProject.RunAutomaticTasks(targetFiles.GetIds(), new[] { AutomaticTaskTemplateIds.PopulateProjectTranslationMemories });

Symptoms: Seemingly randomly, any one of the files is missing from the task, therefore is not translated and does not appear in the task report. 

Because the error can occur randomly, I cannot get the app to fail on demand.

However, if I loop through the command 10 times, on average it will fail twice. The file that is missed can change, so it's not as if it is the first, second or last in the file list.

Pre-translate 01 & 02 includes all three files:

XML code snippet showing a 'translate' task with three files listed: apfel.xml.sdlxliff, banane.xml.sdlxliff, and kirsche.xml.sdlxliff, each with a unique GUID.

Pre-translate 03 (<3 seconds later) only includes two of the three files:

XML code snippet showing a 'translate' task with two files listed: apfel.xml.sdlxliff and banane.xml.sdlxliff, each with a unique GUID. The kirsche.xml.sdlxliff file is missing.

Because the command is in a loop, no variables or settings are changed.

Issue occurs in both Trados Studio 2022 17.0.0.11594 and SR1 17.1.6.16252.

I'm interested if anyone else has experienced anything similar, a solution/workaround and/or has a more robust method of running the automatic tasks.

Any troubleshooting suggestions are most welcome.

Thanks in advance,

Samuel



Generated Image Alt-Text
[edited by: RWS Community AI at 8:02 AM (GMT 0) on 15 Nov 2024]
Parents Reply Children