Problem with translation of multiple formatter fields turning HTML into string

Created on 22 September 2024, 4 months ago

Problem/Motivation

When using the ai module version 1.0.x, there is an issue with translating multiple fields of the "Text (formatted, long)" type. While the first formatter field is translated correctly, preserving HTML tags (such as <h3>, <ul>, etc.), the second formatter field in the same entity transforms the HTML tags into plain strings, breaking the formatting in the frontend.

Steps to reproduce

  1. Add two fields of type "Text (formatted, long)" to a content type.
  2. Populate both fields with content that includes HTML tags.
  3. Translate the content using the ai_translate module.
  4. Observe that the first field preserves the HTML tags in the translation, while the second field transforms the HTML tags into strings.

Proposed resolution

The issue is resolved by modifying the translateSingleText function to ensure that the field's format is properly handled during the translation process. This fix ensures that HTML tags are preserved for all formatter fields, including the second field and beyond.

Remaining tasks

  • Review the proposed patch.
  • Test the patch with various field formats, including custom formats.
  • Commit the patch if all tests pass.
🐛 Bug report
Status

Needs review

Version

1.0

Component

Other Submodules

Created by

🇵🇹Portugal developer-rocha

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024