# Translation memories

- OmegaT and TMX files
  - Location and purpose
  - TMX backup
  - TMX and Language
- How OmegaT remembers your translations
- Using memories created by other translation tools
  - Importing files
  - Imported files handling
- Using OmegaT translation memories in other translation tools
- Upgrading Translation Memories

# OmegaT and TMX files

## TMX files - location and purpose

OmegaT uses TMX files in 3 separate locations.

- The `/omegat/` folder contains `project_save.tmx` and eventually a number of backup TMX files.

  The file `project_save.tmx` contains all the segments that have been memorized since you started the project.

- The project main folder will contain 3 TMX files:

  1. `project_name-omegat.tmx`
  2. `project_name-level1.tmx`
  3. `project_name-level2.tmx`
  (project_name being the name of your project).

  These files contain the source and target segments corresponding to the contents of the /source/ folder at the time of their creation (usually when the translated files have been created).

  - The `level1` file contains only textual information.
  - The `level2` file encapsulates OmegaT specific tags in correct TMX tags so that the file can be used with its formatting information in a translation tool that supports TMX level 2 memories, or OmegaT itself.
  - The `omegat` file includes OmegaT specific formating tags so that the file can be used in other OmegaT projects

- The `/tm/` folder can contain any number of TMX files.

  Such files must be correct TMX files and can either contain only textual information (level 1 TMX), OmegaT textual and formatting information (omegat TMX) or TMX textual and formatting information (level 2 TMX).

## TMX backup

When you translate your files, OmegaT stores all your progress in translation memory in the project's `/omegat` subdirectory.

OmegaT also backups translation memory to `project_save.tmx.YEARMMDDHHNN.bak` in the same subdirectory every time when a project is opened or reloaded. `YEAR` is 4-digit year, `MM` is a month, `DD` day of the month, `HH` and `NN` are hours and minutes when the previous translation memory was saved.

If you think you have lost translation data follow this procedure:

1. close the project
2. rename the current `project_save.tmx` file to something you will remember (like `project_save.tmx.temporary` for example)
3. select the backup translation memory that is the most likely to contain the data you are looking for
4. rename it to `project_save.tmx`
5. open the project

## TMX files and language

TMX files contain translation units that are made of a number of equivalent segments in different languages. A translation unit is made of at least two translation unit variations (tuv). Either can be used as source or target.

The settings in your project will indicate which is the source language and which is the target language. OmegaT will thus take the tuv corresponding to the project source language code and use that segment as the source segment, and it will take the tuv corresponding to the project target language code and use that segment as the target segment. OmegaT recognizes them using the following two standard conventions:

- 2 letters (e.g. JA for Japanese), or
- 2-letter language code followed by the 2-letter country code (e.g. EN-US)

See Languages for a partial list of language and country codes.

If the project language codes and the TMX language codes fully match, the segments are loaded in memory. If the codes match only the language but not the country, the segments are also loaded in memory. If neither the language code not the country code match, the segments are not loaded in memory.

# How OmegaT remembers your translations

The file `project_save.tmx` contains all the segments that have been memorized since you started the project. If you do any modification on the project segmentation for example, `project_save.tmx` will record new translation pairs but will retain all the previous information.

This will occasionally lead to the display of orphan strings in the Match Viewer. Such matches no longer refer to segments existing in the source documents, but to segments recorded before the modifications took place. If the modification was a mistake, revert to the previous settings and the older recordings will reappear.

# Using memories created by other translation tools

## Importing files

OmegaT supports importing TMX versions 1.1-1.4b (both level 1 and level 2). This enables the translation memories produced by other tools to be read by OmegaT. However, OmegaT does not fully support imported level 2 TMX files (that store not only the translation, but also the formatting), so the quality of fuzzy matches will be a bit lower when importing level 2 TMX files.

## Imported files handling

OmegaT follows very strict procedures when handling translation memory files (TMX files). If any mistake is found in such a file, OmegaT will simply not load it.

Some tools are known to produce invalid TMX files in certain conditions. If you want to use such files as reference translations in OmegaT, they will need to be fixed if OmegaT refuses them. Fixes are trivial operations and OmegaT will give you indications in the related error message. You can ask the user group for advice if you have problems.

# Using OmegaT translation memories in other translation tools

OmegaT exports TMX files version 1.4 (both level 1 and level 2). The level 2 export is not a standard level 2 but is enough to generate correct matches in TMX Level 2 supporting translation tools. If you only need textual information (and not formatting information), use the level 1 file that OmegaT has created.

# Upgrading translation memories

Previous versions of OmegaT were capable of segmenting source files into paragraphs only, and were inconsistently numbering formatting tags in HTML and Open Document files. OmegaT 1.7.3 can detect and upgrade such TMX files on the fly to increase fuzzy matching quality and leverage your existing translation better -- so that you don't have to redo it.

A project's TMX will be upgraded only once, and will be written in upgraded form, and legacy TMX files will be upgraded on the fly each time the project is loaded. Note that some changes in file filters in OmegaT 1.7.3 may lead to totally different segmentation, thus in rare cases you will have to upgrade your translation manually.

Legal notices