Problem
We send strings containing HTML tags to ChatGPT for translations. We tell him to leave the HMTL tags alone, but it's possible that he could hallucinate and break HTML that we need to work to keep the UI rendering as expected.
Solution
Similar to what we did for template placeholders, validate that the HTML is not broken by a translation, and retry if it is.
Note that there are some html attributes (such as alt on an img tag) that we do want translated. So we should create a whitelist of attributes that should be translated, and not throw if those are changed, but throw if any others (such as id, class, data-) are changed
Problem
We send strings containing HTML tags to ChatGPT for translations. We tell him to leave the HMTL tags alone, but it's possible that he could hallucinate and break HTML that we need to work to keep the UI rendering as expected.
Solution
Similar to what we did for template placeholders, validate that the HTML is not broken by a translation, and retry if it is.
Note that there are some html attributes (such as
alton animgtag) that we do want translated. So we should create a whitelist of attributes that should be translated, and not throw if those are changed, but throw if any others (such asid,class,data-) are changed