# V2 Dynamic Text Insertion

This document defines dynamic text insertion for `TODOS.phase-72.72.11.1.8`.
Dynamic text uses named variables such as `{count}` and `{item_name}` and
resolves count-driven grammar before rendering.

## Data Files

Rules live in `V2/ue/Content/Localization/V2/Dynamic/DynamicTextRules_V2.json`.
Dynamic string templates live in
`V2/ue/Content/Localization/V2/Dynamic/DynamicTextStrings_V2.json`. Sample
runtime contexts live in
`V2/ue/Content/Localization/V2/Dynamic/DynamicTextContexts_V2.json`.

The sample string is `loc.system.loot.found_items.body`:

```text
You found {count} {item_name}.
```

`{count}` drives singular or plural grammar. `{item_name}` can provide singular
and plural localized term forms, allowing the formatter to render `Ash Saber`
for count `1` and `Ash Sabers` for count `3`.

## Evaluation

`V2/ue/Tools/evaluate-v2-dynamic-text.py` writes
`V2/ue/Content/Localization/V2/Dynamic/DynamicTextEvaluation_V2.json`.

Tracked expected outputs:

- `loot.ash_saber.one`: `You found 1 Ash Saber.`
- `loot.ash_saber.many`: `You found 3 Ash Sabers.`
- `loot.health_potion.zero`: `You found 0 Health Potions.`

Missing variables use the `block_build` policy.

## Verification

Run this gate after changing rules, templates, contexts, evaluator logic,
generated output, docs, or CI wiring:

```bash
python3 V2/ue/Tools/check-v2-dynamic-text.py
```

Required release gates:

- `localization-dynamic-text-contract`
- `localization-dynamic-text-variable-substitution`
- `localization-dynamic-text-singular-term`
- `localization-dynamic-text-plural-term`
- `localization-dynamic-text-missing-variable-guard`
- `localization-dynamic-text-ci-wired`
