Best Practices for Importing a Translation Memory (TM)


This article covers translation memory import and describes how to prepare the import file.

Before reading this article, we recommend that you find out how to import an XTM Cloud translation memory. See How to import a translation memory (TM) into XTM Cloud.

Before reading this article, we recommend that you find out how to import an XTM Cloud translation memory. See How to import a translation memory (TM) into XTM Cloud.


During TM import, each trans-unit (source/target segment pair) is treated as a separate entity and not as a sequence. For the context to be imported into the TM, it need to be specified for each trans-unit, with the proper syntax. Example:

<tu changedate="20180614T064017Z" creationdate="20180610T235807Z" creationid="exampleid" changeid="exampleid"> <prop type="client">exampleclient</prop> <prop type="project">exampleproject</prop> <prop type="domain">exampledomain</prop> <prop type="subject"> </prop> <prop type="corrected">no</prop> <prop type="aligned">no</prop> <tuv xml:lang="en-us"> <prop type="x-context-pre"><seg>previouscontext</seg></prop> <prop type="x-context-post"><seg>nextcontext</seg></prop> <seg>Test</seg> </tuv> <tuv xml:lang="ja"> <seg>Test</seg> </tuv> </tu>

As you might have spotted, the contexts are placed in the <prop type="x-context-pre"> and <prop type="x-context-post"> tags:

<prop type="x-context-pre"><seg>previouscontext</seg></prop> <prop type="x-context-post"><seg>nextcontext</seg></prop>

The .tmx file containing the trans-units, which is exported from XTM Cloud, will not contain the x-context-pre and x-context-post tags. Example:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE tmx SYSTEM "tmx14.dtd"> <tmx version="1.4"> <header adminlang="en-US" creationtool="XTM" creationtoolversion="$Revision$" datatype="xml" o-tmf="XTM" srclang="en-US" segtype="sentence"> <prop type="user-defined">CUSTOMER: test_59645</prop> </header> <body> <tu creationdate="20220506T103004Z" creationid="8691364,137286998" changedate="20220509T014114Z" changeid="8691364,137288593" tuid="26179868"> <prop type="x-Project">Product</prop> <prop type="x-previous-crc">1098448520</prop> <prop type="x-next-crc">4043906193</prop> <prop type="x-previous-target-crc">67209676</prop> <prop type="x-next-target-crc">1884799095</prop> <prop type="x-previous-source-text">Share your screen in a nearby conference room</prop> <prop type="x-next-source-text">Dial in</prop> <prop type="x-previous-target-text">在邻近的会议室中共享您的屏幕</prop> <prop type="x-next-target-text">拨入</prop> <prop type="x-segment-id">StopSharing</prop> <prop type="Status">new</prop> <prop type="x-xtm-status">approved</prop> <tuv xml:lang="en-US"> <seg>Stop sharing</seg> </tuv> <tuv xml:lang="zh-CN"> <seg>停止共享</seg> </tuv> </tu> </body> </tmx>

In this file, we can see that the tool used to create the file was XTM Cloud: creationtool="XTM". This means that the contexts have already been converted. You will find them in the <prop type="x-previous-source-text"> tags. There are also hash codes in <prop type="x-previous-crc"> tags and <prop type="x-next-source-text"> tags and also hash codes in <prop type="x-next-crc"> tags.

For comparison, the contexts of a file from an external tool, before conversion, would look like this:

<?xml version="1.0" encoding="utf-16"?> <!DOCTYPE tmx SYSTEM "tmx14.dtd"> <tmx version="1.4"> <header creationtool="externalToolName" creationtoolversion="9.2.5" segtype="sentence" adminlang="en-us" creationid="Admin" srclang="en-us" o-tmf="externalToolName" datatype="unknown"> <prop type="defclient">test</prop> <prop type="defproject"> </prop> <prop type="defdomain"> </prop> <prop type="defsubject"> </prop> <prop type="description">some description</prop> <prop type="targetlang">fr-fr</prop> <prop type="name">fr-FR</prop> </header> <body> <tu changedate="20191002T105401Z" creationdate="20190926T083806Z" creationid="id" changeid="id"> <prop type="client">test</prop> <prop type="project">Project Doc</prop> <prop type="domain">test</prop> <prop type="subject">test</prop> <prop type="corrected">no</prop> <prop type="aligned">no</prop> <prop type="x-document">Project Doc.docx</prop> <tuv xml:lang="en-us"> <prop type="x-context-pre">exemplary previous context</prop> <prop type="x-context-post">exemplary next context</prop> <seg>test src segment</seg> </tuv> <tuv xml:lang="fr-fr"> <seg>test translation</seg> </tuv> </tu> </body> </tmx>