AutomaticTaskTemplateIds.TranslationCount does not change the ConfirmationStatistics.CombinedConfirmationLevel

Hi,

When I rewrite target files with fully translated ones I would like to run "translationCount" task to propagate file statuses from "In Translation" to "Translated". If I do it in the Trados Studio, the statuses are changed after the translation count finished. If I do it through API the file status doesn't change immediately. Here is some easy way for implementation:

public void AutomaticTask_TranslationCount_ONE(ProjectFile fileName)
{
      Guid[] fileID = { fileName.Id };
      activeProj.AddNewFileVersion(fileID[0], fileName.LocalFilePath);
      AutomaticTask tcount = activeProj.RunAutomaticTask(fileID, AutomaticTaskTemplateIds.TranslationCount);
      activeProj.Save();
}

 //*ProjectFile[] FileNames = activeProj.GetTargetLanguageFiles();

FileBasedProject activeProj = new FileBasedProject('FilePath to sdlproj');*//

Is there any more I should do to implement same behavior as Trados Studio (immediately change CombinedConfirmationLevel from "InTranslation" to "Translated")?

  • Hi , I can't see immediately anything wrong with your sample code, but would like to reproduce on my side... I'll add an item on our board to review this and circle back to you with some feedback.

    Internal tracking id: SDLCOM-3667

    emoji
  • Hi  ,

    After carefully investigating this, here are my thoughts:

    - At this time, using the Project Automation API, you can only overwrite *source language files*
    - Overwriting a source language file using AddNewFileVersion is correct, however, this will not overwrite the target language file, and there is no API to force overwriting a target language file.
    - however, I have devised a workaround, which you can find useful.

    The workaround:
    - You can directly overwrite the target language file using the File.Copy API
    - After that, simply run the TranslationCount task, and it will work
    - Here's an example that fully reproduces this.

    Screenshot of code in an IDE with methods to test copying to target folder in Trados Studio, including handling of target language files and running AnalyzeFiles and TranslationCount tasks.

    More information:
    - I have accounted for the fact that your Trados Studio project may have several target languages. Thus, the first task is to find out the target language of your file. For that, the simple solution is to create a dummy Trados Studio project, add your target file, then extract the target language from there. Of course, you can choose to parse the target language file yourself and find the target language from there, it's your choice
    - once I find the location of the target file within your Trados Studio project, I simply overwrite it
    - then, I run AnalyzeFiles and TranslationCount on all target language files (IMPORTANT: these tasks need to be run on the target language files, not on the source language files).

    And now, everything works. Hope this solves your problem, please let me know your thoughts!

    Best,
    John

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 1:36 PM (GMT 0) on 5 Mar 2024]