Markup lost/literal HTML tags visible

Created on 4 March 2025, about 1 month ago

Problem/Motivation

(I think?) this is a follow-up to 💬 Support for nested paragraphs translation Active .
When there is a "text editor (formatted, long)" field in a paragraph (first level, no nesting here), the content does get translated properly.
However, the HTML seems to get escaped, as I see literal HTML tags in the translated version.

Steps to reproduce

Create a paragraph (let's call it "HTML box")
Add a "text editor (formatted, long)" field
Use it in some content type
Create content of this type
Add "HTML box" paragraph
Fill it with content that has HTML markup in it.
Translate this node.
Translated version has visible tags instead of interpreted ones.

🐛 Bug report
Status

Active

Version

1.3

Component

Code

Created by

🇦🇹Austria tgoeg

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @tgoeg
  • 🇮🇹Italy bigbabert Milano, Italy
    • alaindessi committed 3f4b3b64 on 1.0.x
      Issue #3510873 by tgoeg, bigbabert: Markup lost/literal HTML tags...
  • 🇮🇹Italy bigbabert Milano, Italy

    Hi @tgoeg,

    thanks for reporting, i did a major re-factor of the code and added in 1.3.4 the fix for that using the above code:

    if (isset($sub_widget['#format'])) {
    $sub_widget['value']['#format'] = $entity->get($field_name)->format;
    }
    if (isset($sub_widget['#text_format'])) {
    $sub_widget['value']['#text_format'] = $entity->get($field_name)->format;
    }

    Please if you found still issue re-open it.

    Best regards

  • 🇮🇹Italy bigbabert Milano, Italy
  • 🇦🇹Austria tgoeg

    Thanks for the quick fix again!
    I thought I'd write:
    I still see literal HTML tags with 1.3.6-beta1, though they get away once I edit the respective paragraphs. I see them (and the translated strings) as soon as I edit the node, even before editing the paragraphs themselves (all done in preview mode when editing an article).

    Now I saved the translation with its visible HTML tags and deleted the translation afterwards.
    When I add a new translation now, I don't get any HTML tags nor do I get any translation of paragraphs when initially editing the new translation. As soon as I click "edit" on a paragraph, it does get translated and HTML tags are correctly parsed.
    So I think this can be considered fixed and there might have been some caching issue from the version before. Just wanted to note this down if its ever relevant for anyone seeing the same.

    Thanks again!

  • 🇮🇹Italy bigbabert Milano, Italy

    Hi @tgoeg,

    thanks to confirm the fix, the cache issue with previous version of the module was due to the fact that paragraphs was saved during the translation, now only the values in the form are updated.

    Best regards

Production build 0.71.5 2024