Skip to main content

TMX files and format

This is an overview of what a TMX file is and it's basic format

Written by Christos Balafoutis

TMX (Translation Memory eXchange) is an XML-based standard file format for storing and exchanging translation memories between translation tools. A translation memory is a database of previously translated phrases and sentences, which helps you translate new content.


Structure of a TMX file

A TMX file is XML, so it uses tags and attributes. It has a header section, followed by a body section that contains the translation units.

  • Header: information about the translation memory, such as the source language, the tool that created it, and when it was created.

  • Body: one or more translation units (<tu>). Each translation unit holds one translated phrase or sentence, plural or not, as one translation unit variant (<tuv>) per language.

  • Segment: each <tuv> contains a <seg> element with the text of the phrase or sentence in that language.

A TMX file can also include other elements and attributes, such as notes and properties, that add context to the translations.


Example TMX file

This is a basic TMX file with four translation units. Each one has three variants, in English, French, and Spanish. The last two translation units are plural forms, and they carry extra <prop> elements with the source group identifier and the plural rule.

<?xml version="1.0" encoding="UTF-8"?>
<tmx version="1.4">
<header
creationtool="MyTranslationTool"
creationtoolversion="1.0"
segtype="sentence"
o-tmf="tmx"
adminlang="en-US"
srclang="en-US"
datatype="plaintext"
/>
<body>
<tu>
<tuv xml:lang="en-US" creationdate="20240212T191726" lastusagedate="20240212T191726">
<seg>Hello, how are you?</seg>
</tuv>
<tuv xml:lang="fr-FR" creationdate="20240212T191726" lastusagedate="20240212T191726">
<seg>Bonjour, comment vas-tu?</seg>
</tuv>
<tuv xml:lang="es-ES" creationdate="20240212T191726" lastusagedate="20240212T191726">
<seg>Hola, ¿cómo estás?</seg>
</tuv>
</tu>
<tu>
<tuv xml:lang="en-US" creationdate="20240212T191726" lastusagedate="20240212T191726">
<seg>I am fine, thank you.</seg>
</tuv>
<tuv xml:lang="fr-FR" creationdate="20240212T191726" lastusagedate="20240212T191726">
<seg>Je vais bien, merci.</seg>
</tuv>
<tuv xml:lang="es-ES" creationdate="20240212T191726" lastusagedate="20240212T191726">
<seg>Estoy bien, gracias.</seg>
</tuv>
</tu>
<tu>
<prop type="x-Plural-Source-Group">src-plural-id</prop>
<prop type="x-Plural-Rule">one</prop>
<tuv xml:lang="en-US" creationdate="20240212T191726" lastusagedate="20240212T191726">
<seg>{count} file</seg>
</tuv>
<tuv xml:lang="fr-FR" creationdate="20240212T191726" lastusagedate="20240212T191726">
<prop type="x-Plural-Translation-Group">tr-plural-id-1</prop>
<seg>{count} dossier</seg>
</tuv>
<tuv xml:lang="es-ES" creationdate="20240212T191726" lastusagedate="20240212T191726">
<prop type="x-Plural-Translation-Group">tr-plural-id-2</prop>
<seg>{count} archivo</seg>
</tuv>
</tu>
<tu>
<prop type="x-Plural-Source-Group">src-plural-id</prop>
<prop type="x-Plural-Rule">other</prop>
<tuv xml:lang="en-US" creationdate="20240212T191726" lastusagedate="20240212T191726">
<seg>{count} files</seg>
</tuv>
<tuv xml:lang="fr-FR" creationdate="20240212T191726" lastusagedate="20240212T191726">
<prop type="x-Plural-Translation-Group">tr-plural-id-1</prop>
<seg>{count} dossiers</seg>
</tuv>
<tuv xml:lang="es-ES" creationdate="20240212T191726" lastusagedate="20240212T191726">
<prop type="x-Plural-Translation-Group">tr-plural-id-2</prop>
<seg>{count} archivos</seg>
</tuv>
</tu>
</body>
</tmx>

Each <tuv> contains a single <seg>, which is the text in that language. For plural entries, the <tuv> of a translation language also contains a translation group identifier. These identifiers group all the plural forms of one string in a specific language (source or translation).

The srclang attribute of the <header> element sets the source language of the translations, English in this example. The xml:lang attribute of each <tuv> element sets the language of that variant.


Example with creation and usage dates

The following file is also a basic TMX file. The <header> element has a creationdate attribute with the date the file was created. Each <tuv> has a creationdate attribute with the date the entry was created and a lastusagedate attribute with the date the entry was last used.

<?xml version="1.0" encoding="UTF-8"?>
<tmx version="1.4">
<header
adminlang="en-US"
srclang="en-US"
creationtool="MyTranslationTool"
creationtoolversion="1.0"
creationdate="20240212T141145Z"
datatype="plaintext"
segtype="sentence"
o-tmf="tmx"
/>
<body>
<tu>
<tuv xml:lang="en-US" creationdate="20240209T233730" lastusagedate="20240209T233730">
<seg>Hello, how are you?</seg>
</tuv>
<tuv xml:lang="fr-FR" creationdate="20240209T233730" lastusagedate="20240209T233730">
<seg>Bonjour, comment vas-tu?</seg>
</tuv>
<tuv xml:lang="es-ES" creationdate="20240209T233730" lastusagedate="20240209T233730">
<seg>Hola, ¿cómo estás?</seg>
</tuv>
</tu>
<tu>
<tuv xml:lang="en-US" creationdate="20231218T185622" lastusagedate="20231218T185622">
<seg>I am fine, thank you.</seg>
</tuv>
<tuv xml:lang="fr-FR" creationdate="20231218T185622" lastusagedate="20231218T185622">
<seg>Je vais bien, merci.</seg>
</tuv>
<tuv xml:lang="es-ES" creationdate="20231218T185622" lastusagedate="20231218T185622">
<seg>Estoy bien, gracias.</seg>
</tuv>
</tu>
</body>
</tmx>

⚠️ Warning:

  • Keep the TMX format intact when you split a TMX file into smaller parts or move a TMX file from another CAT tool to Transifex.

  • TMX files that contain a carriage return (\r) cannot be imported into Transifex, because of XML syntax restrictions. To avoid this, Transifex converts every \r in a Translation Memory entry to the &#13; XML entity when it generates a TMX file. The file then uploads without XML validation errors.


File size limits

Large files may fail. Transifex imports work up to about 100MB and exports up to about 500MB. These are practical limits that come from server capacity, not hard caps.

For the steps to import a TMX file, see Uploading a TMX File.


💡 Tip

Looking for more help? Get support from our Transifex Community Forum!

Find answers or post to get help from Transifex Support and our Community.

Did this answer your question?