Import in Groupshare TMs with Studio 2019

Hi everyone,

I am currently upgrading a Studio plugin from Studio 2015 to Studio 2019.

One part of the plugin consists in importing an SDLXLIFF file in a Groupshare TM. To do so, I used to use the ScheduledTranslationMemoryImportOperation constructor where I would have used the following methods (in the following sequence) to load the import operation on the server:

Create: to create the import operation

Upload: to upload the import file

Queue: to queue the instance of the import operation.

With Studio 2019, it seems the constructor ScheduledTranslationMemoryImportOperation does not exist anymore in the Sdl.LanguagePlatform.TranslationMemoryApi namespace. However, there seems to be a new constructor which might replace the above-mentionend constructor. It is named ScheduledServerTranslationMemoryImport.

My questions are:

1. Does the ScheduledServerTranslationMemoryImport constructor replace the ScheduledTranslationMemoryImportOperation? I can't see any trace of this new constructor in the documentation

2. Apparently, the new constructor has no "Create" and "Upload" methods. Which methods should be applied? Does the "Queue" method cover both the "create" and "upload" process?

Thank you in advance for your support.

Regards,

Laurent

 

 

 

Parents Reply Children
  • I reply my own question to report that I found a solution or at least a workaround.

    It seems that the methods import.Queue(); and import.refresh(); are run asynchronously in the background.

    The following fix worked for me.

    Instead of calling the methods directly, I created a task to run them:

    Using the example code from here:
     github.com/.../ServerImporter.cs

    I changed this code:
    #region "upload"
    importer.Queue();
    #endregion

    To this:

    #region "upload"
    Task LaunchImport = new Task(() => importer.Queue());
    LaunchImport.Start();
    #endregion

    Then, further down in the sample code, I had to change the code to refresh the status:

    I changed this code:

    case ScheduledOperationStatus.Recovery:
    continueWaiting = true;
    importer.Refresh();
    break;

    To this:

    case ScheduledOperationStatus.Recovery:
    continueWaiting = true;
    Task LaunchRefresh = new Task(() => importer.Refresh());
    LaunchRefresh.Start();
    break;

    With these two changes, the code keeps polling the status of the task until it is flagged as completed and then it finishes correctly.

    There are probably easier ways to handle this but this worked for me.

    I hope this is still useful somehow for   and   after so many years. Slight smile

    Surely my workaround can be improved a lot but it would be great if the sample code could somehow reflect this possibility.

    Daniel

  • Hi Daniel,

    Happy to read that you found a workaround.

    To be honest, I can't remember how I solved the problem back then and it is not long current for us since we moved all our translation memories to WorldServer for approx. 3 years.

    I have a vague recollection that I finally did not need it and could make it work without. But as I said, it has been a long time.

    Best wishes to Frankfurt from a sunny and snowy Munich.

    Regards,

    Laurent