Exporting a Server TM using the TranslationMemory API results in a TMX file that misses the context matching information

Hi, originally, I posted this question here, but I think I chose the wrong forum at least there was zero feedback ... So I post here again and hope to receive feedback here Slight smile

I have detected a problem with the Exporter class in the TranslationMemory API. The problem is that - when a server TM gets exported, the TMX is missing the context information after the export.

Here is my code:

Dim TMExporter As New Sdl.LanguagePlatform.TranslationMemoryApi.TranslationMemoryExporter(ServerBasedTranslationMemory.GetLanguageDirection(LangDir))

TMExporter.ChunkSize = 100

TMExporter.FilterExpression = GetFilterCreatedAt()

AddHandler TMExporter.BatchExported, AddressOf Exporter_BatchExported

strExportfile = ExportFolder & "\" & ServerTM & "_" & LanguageDirection.SourceLanguageCode.ToString & "_" & LanguageDirection.TargetLanguageCode.ToString & ".tmx"

Try

      Dim strNow As String = Now.ToString("yyyyMMdd_HHmmss")

      TMExporter.Export(strExportfile, True)

      System.IO.File.AppendAllText(LogFile, ControlChars.CrLf & strNow & " SUCCESS: " & ServerTM & " , Source Language: " & LanguageDirection.SourceLanguageCode.ToString & " , Target Language: " & LanguageDirection.TargetLanguageCode.ToString
      & " was successfully exported to " & strExportfile & ". " & exportProgress.ToString & " TUs were exported." & ControlChars.CrLf)

Catch ex As Exception

      Dim strNow As String = Now.ToString("yyyyMMdd_HHmmss")

      System.IO.File.AppendAllText(LogFile, ControlChars.CrLf & strNow & " ERROR: " & ServerTM & " , Source Language: " & LanguageDirection.SourceLanguageCode.ToString & " , Target Language: " & LanguageDirection.TargetLanguageCode.ToString &
      " could not be exported. The original error message was: " & ex.ToString & ControlChars.CrLf)

      System.IO.File.Delete(ExportFolder & "\" & ServerTM & "_" & LanguageDirection.SourceLanguageCode.ToString & "_" & LanguageDirection.TargetLanguageCode.ToString & ".tmx")

End Try

This code - when run on a local SDLTM exports everything just fine including the context information:

Screenshot of Trados Studio TMX code with highlighted section showing missing context information after export from a server TM.

But when I run it on a server TM, the TMX misses the context information after the export finishes:

Screenshot of Trados Studio TMX code with no visible errors or warnings, context information appears to be present.

I can also export the server TM from Trados Studio and from the Groupshare Web UI just fine and the exports always include the context information.

Also, as I said before - export from a SDLTM through the API also creates a TMX that includes the context information. 

It is really only the export from a server TM through the TM API that loses the context information. Is this a known issue? It basically means that - whereever automation of exporting TMX from server TMs is used to backup the TM data, this will currently lose the context information. 



Generated Image Alt-Text
[edited by: Trados AI at 4:12 AM (GMT 0) on 5 Mar 2024]
Parents Reply
  • Please try the following and let me know how it goes.

    string sourceFilePath = "compressed.gz"; // Replace with your source GZip file path
    string extractedFilePath = "extracted.txt"; // Replace with the desired output file path
    
    try
    {
        using (FileStream sourceFileStream = File.OpenRead(sourceFilePath))
        using (FileStream extractedFileStream = File.Create(extractedFilePath))
        using (GZipStream gzipStream = new GZipStream(sourceFileStream, CompressionMode.Decompress))
        {
            byte[] buffer = new byte[4096];
            int bytesRead;
    
            while ((bytesRead = gzipStream.Read(buffer, 0, buffer.Length)) > 0)
            {
                extractedFileStream.Write(buffer, 0, bytesRead);
            }
    
            Console.WriteLine("File extraction complete.");
        }
    }
    catch (Exception ex)
    {
        //TODO
    }

Children