# Translation memory

How translation memory matches source text against previous translations: match types, the shared organization TM, automatic 100% matches, settings and TMX import.

Canonical: https://comvi.io/docs/platform/translation-memory

Translation memory (TM) stores `(source, target)` pairs and offers them as suggestions every
time a translator opens a key. A phrase translated once in any project of the organization
that authors in the same source language comes back as a match.

## Match types

| Match | Meaning | Score |
|---|---|---|
| **Perfect** | Same source text, same key context | 101 |
| **Exact** | Same source text, different key | 100 |
| **Fuzzy** | Similar source text, scored by shared substrings | 50 to 99 |

Perfect and exact matches are hashed lookups; perfect scores 101 so it always sorts first.
Fuzzy results below 50 are discarded, and 50 is also the lowest value the TM search API
accepts. Matches sort by score, and the more-used pair wins a tie. Trust perfect matches,
glance at exact ones, and re-read fuzzy ones: the score says the strings are similar, not
that the translations are interchangeable.

## Project TM and shared TM

Every project gets its own writable TM, where new translations saved in the project
accumulate. The organization also has one shared TM per source language. A shared TM whose
source language matches the project's contributes matches whether or not it is assigned;
assigning it adds it to the project's TM list. A TM built in an English-source project
contributes nothing to a project that authors in German.

1. Open **Translation Memory** in the sidebar, under Resources.

2. On the **Entries** tab, turn on the organization TM. Comvi creates one named
   `Shared TM (<source locale>)` the first time and assigns it to the project as read-only.

3. On the **Settings** tab, set what the project's own TM stores, then click
   **Save Settings**.

| Setting | Effect |
|---|---|
| **Auto-populate** | New translations saved in the project are added to the TM. On by default |
| **Only approved translations** | Only `Translated` values are stored. Off by default |

Each assignment also carries a **priority** (higher numbers are read first) and a
**penalty** (a percentage subtracted from every match from that TM, for a memory that is
relevant but less trusted). Both are set through the REST API only; the dashboard assigns
the shared TM at priority 1 with no penalty.

## Suggestions in the editor

Each match in the side panel shows the matched source text, the suggested translation, the
score and match type, which TM and project it came from, and how often the pair has been
used. Click **Apply** to drop it into the editor and edit before saving. Applying is an
ordinary save, so the value lands as **Needs Review**.

## Automatic 100% matches

When a key is created or its source text changes, and the project has at least one
machine-translation provider enabled, Comvi checks the TM for a 100% match on every target
language before queuing machine translation. A match is written straight away and recorded
as a TM auto-apply, whether or not MT auto-apply is on; MT runs only for the languages with
no match. Bulk translation has no such shortcut. See
[Machine translation](/docs/platform/machine-translation).

## TMX import and export

Both live on the **Entries** tab. **Import** takes a `.tmx` or `.xml` file whose source
language matches the TM's, capped at 50,000 translation units per file (split larger files
by language pair), and reports entries imported, skipped and failed. **Conflict Resolution**
offers **Skip existing** (default), **Overwrite existing** and **Keep highest quality**.
Locale mapping is available on the REST API only. **Export** downloads the TM as TMX.

> **Cleaning a noisy TM**
>
> Turn on **Only approved translations** so only `Translated` values are stored from now on,
> then wait it out or export, clean and re-import with **Overwrite existing**.

## Troubleshooting

- **No fuzzy matches.** Check that a TM in use holds content for this language pair. Source
strings under about four characters rarely score.
- **A saved translation is not in the TM.** Check **Auto-populate**. With **Only approved
translations** on, a plain save lands as **Needs Review** and is not stored until someone
marks it **Translated**.

## Next steps

- [Machine translation](/docs/platform/machine-translation): First drafts when TM has no match.
- [Glossaries](/docs/platform/glossaries): Terminology at the term level, not the segment level.
- [Translation lifecycle](/docs/platform/translation-lifecycle): How TM-applied values move through review.
- [Translations](/docs/platform/translations): The editor where TM suggestions appear.
