AI translation breaks HTML structure when translating formatted text fields
## Problem/Motivation
When using ai_tmgmt with OpenAI models (tested with gpt-4o and gpt-5.4-mini), HTML content is frequently corrupted during translation.
This happens even with strict prompts like:
- "Do not modify HTML tags"
- "Only translate text nodes"
The result is broken markup, for example:
- split tags (
closed mid-sentence)
- broken attributes (data-\* attributes split into pieces)
- misplaced text outside of tags
- invalid HTML structure
Example:
Input:
```
<ul>
<li data-list-item-id="e225c9649270e6c96f54dd8a678b8b3b4">
Musical instruments
</li>
<li data-list-item-id="ed768821d35fd31bcc21e3b4f14721fcb">
Large packages, suitcases, carry-on luggage, and other such parcels.
</li>
</ul>
```
Output:
```
<ul>
<li data-list-item-id="e225c9649270e6c96f54dd8a678b8b3b4">
Musikinstrumente
</li>
</ul>
<p>
li data-list-item-id="ed768821d35fd31bcc21e3b4f14721fcb">Große Pakete, Koffer, Handgepäck und andere ähnliche Pakete.
</p>
<ul>
```
This makes the translated content unusable.
---
## Steps to reproduce
1. Enable ai_tmgmt
2. Configure OpenAI translator (gpt-4o or similar)
3. Translate a node field containing HTML with attributes (e.g.
* \<li data-\*="..."\>)
* Observe output
---
## Expected behavior
HTML structure should remain identical. Only text nodes should be translated.
---
## Actual behavior
HTML is corrupted:
- tags are split or reordered
- attributes are broken
- content is moved outside of tags
---
## Versions
* Drupal core 11.3.8
* AI (Artificial Intelligence) 1.4.0-rc1
* AI Translation Management (TMGMT) 1.0.0-beta5
issue