# V2 String Length Validation

This document defines string length validation for `TODOS.phase-72.72.11.1.10`.
The validator checks translated text against the UI space budget from
`maxCharacterLength` and applies per-language character limits for each text
role.

## Limits

`V2/ue/Content/Localization/V2/Length/StringLengthLimits_V2.json` stores the
validated locale list, `warningThresholdPercent`, variable-token samples, and
per-language character limits. Each locale rule provides an expansion ratio and
role-specific caps for buttons, titles, subtitles, body copy, error titles,
names, and screen-reader labels.

## Report

`V2/ue/Tools/validate-v2-string-lengths.py` reads the configured `.v2loc.json`
files and writes
`V2/ue/Content/Localization/V2/Length/StringLengthValidationReport_V2.json`.
Each report row includes:

- locale, source file, string ID, and text role
- raw, runtime-estimated, and effective character counts
- UI space budget from `maxCharacterLength`
- per-language character limit
- near-budget, UI-budget, and locale-cap warnings or errors

Translations that exceed the UI space budget are reported as warnings so
localization QA can review layout risk. Translations that exceed the
per-language character limit are reported as errors.

Run the validator after translation files or limits change:

```bash
python3 V2/ue/Tools/validate-v2-string-lengths.py
```

## Verification

Run this gate after changing length limits, translation files, generated
reports, docs, or CI wiring:

```bash
python3 V2/ue/Tools/check-v2-string-length-validation.py
```

Required release gates:

- `localization-string-length-validation-contract`
- `localization-string-length-validation-limits`
- `localization-string-length-validation-report`
- `localization-string-length-validation-ui-budget-warning`
- `localization-string-length-validation-locale-cap`
- `localization-string-length-validation-ci-wired`
