# V2 Translation Management Platform Integration

This document defines the phase-72 translation management integration for
`TODOS.phase-72.72.11.1.4`. The primary adapter is Phrase, with Crowdin and
Lokalise endpoint metadata kept in the same config so the repository can switch
providers without changing the translation file format.

## Source Push

The source push operation reads
`V2/ue/Content/Localization/V2/Translations/en-US.v2loc.json` and emits
`V2/ue/Content/Localization/V2/TMS/SourcePushPayload_V2.json`.

```bash
python3 V2/ue/Tools/sync-v2-translation-management.py push-source
```

The payload preserves each string ID, `tmsAlias`, source text,
`contextDescription`, `maxCharacterLength`, `screenshotReference`, `textRole`,
variables, occurrence paths, and a deterministic content hash. The request
metadata references `V2_PHRASE_API_TOKEN` as an environment-variable
placeholder; raw credentials must never be committed or printed.

## Translation Pull

The pull operation reads the tracked Phrase fixture at
`V2/ue/Content/Localization/V2/TMS/PhrasePull_fr-FR_V2.json` and writes the
canonical pulled translation file:
`V2/ue/Content/Localization/V2/Translations/fr-FR.v2loc.json`.

```bash
python3 V2/ue/Tools/sync-v2-translation-management.py pull-translations
```

Pulled entries keep the source metadata from the `.v2loc.json` source file and
only replace the locale text and review state from the provider response. This
keeps downstream validation independent of provider-specific JSON, XLIFF, or PO
exports.

## Provider Config

The integration config lives at
`V2/ue/Content/Localization/V2/TMS/TranslationManagementPlatform_V2.json`. It
defines:

- `selectedProvider`: `phrase`.
- `providers`: Crowdin, Lokalise, and Phrase project IDs, token environment
  variables, source push endpoints, and translation pull endpoints.
- `sourceFile`, `sourcePushPayload`, `translationPullPayload`, and
  `pulledTranslationFile`: repository paths used by the deterministic CLI.
- `policy`: push/pull support, metadata preservation, named variable
  preservation, dry-run default behavior, and credential redaction.

## Verification

Run the integration checker after changing the config, provider fixture, sync
tool, pushed payload, pulled translation file, or CI wiring:

```bash
python3 V2/ue/Tools/check-v2-translation-management-platform.py
```

Required release gates:

- `localization-tms-platform-config`
- `localization-tms-push-source-strings`
- `localization-tms-pull-translations`
- `localization-tms-preserve-metadata`
- `localization-tms-redact-credentials`
- `localization-tms-ci-wired`
