fix: #3585525 Preserve HTML markup and entities in translated values

Closes #3585525 (closed)

TextTranslator::translateContent() passed a backtick fence and '"' to trim(), whose second argument is a character mask, so He said "stop" came back without the closing quote. html_entity_decode() then ran on every column, so & in an href became a bare & and an escaped <strong> became a live tag.

#3476038 added that decode behind a format guard. #3529802 abstracted the column loop and the guard was lost.

Rebased onto 1.4.x, so the decode now sits once in EntityTranslationOrchestrator::translateTextMetadataItem() instead of the Controller and Drush duplication.

One commit per change. 414e20d strips the fence only when it wraps the whole response. a6c0279 adds the regression test, eight cases. bcd56bd adds nbsp to the cspell project words. d3ab1d9 decodes only a value that holds &lt; and no real <. d2f4f09 covers text_with_summary and list markup in the test.

Worth a second opinion: plain-text columns carry no format, so they are no longer entity-decoded at all. Previously they were, unconditionally.

The test module exists because EchoProvider in ai_test does not implement translate_text. Not covered: a model returning prose with no tags.

Edited by Giorgio Alfredo Pagano

Merge request reports

Loading
Loading