# V2 Translation Memory Integration

This document defines the phase-72 translation memory integration for
`TODOS.phase-72.72.11.1.5`. Translation memory reuses previously translated
strings before vendor handoff and generates fuzzy suggestions for similar source
strings that still need translator review.

## Memory Source

The `fr-FR` seed memory lives at
`V2/ue/Content/Localization/V2/Memory/TranslationMemory_fr-FR.json`. It stores
previous source text, translated text, context, text role, variables, usage
count, and update timestamp. The minimum fuzzy score is `0.74`.

Memory entries are only eligible when their named variable set matches the
source string. This prevents a fuzzy match from dropping required runtime
variables such as `{speaker_name}` or `{estimated_wait_minutes}`.

## Matching Rules

`V2/ue/Tools/apply-v2-translation-memory.py` reads
`V2/ue/Content/Localization/V2/Translations/en-US.v2loc.json` and produces:

- `V2/ue/Content/Localization/V2/Memory/TranslationMemorySuggestions_fr-FR.json`
- `V2/ue/Content/Localization/V2/Memory/fr-FR.memory-applied.v2loc.json`

Exact matches have score `1.0`, can be reused automatically, and enter the
applied file as `translated`. Fuzzy matches use `SequenceMatcher` over
normalized source text, require a score of at least `0.74`, and enter the
applied file as `needs_translation`.

The tracked sample intentionally keeps `loc.online.ranked.queue_estimate.body`
out of the exact memory and matches it against
`loc.online.casual.queue_estimate.body`, proving the fuzzy path for similar
queue estimate text.

## Verification

Run this gate after changing memory seeds, matching logic, generated
suggestions, applied output, docs, or CI wiring:

```bash
python3 V2/ue/Tools/check-v2-translation-memory-integration.py
```

Required release gates:

- `localization-translation-memory-contract`
- `localization-translation-memory-exact-reuse`
- `localization-translation-memory-fuzzy-match`
- `localization-translation-memory-variable-safe`
- `localization-translation-memory-deterministic-output`
- `localization-translation-memory-ci-wired`
