Skip to content

Issue #2768711: Format title attribute in ContentTranslationHandler.php

Problem

On multilingual sites, fields marked as non-translatable can produce error messages where HTML is escaped. For example, a user image field shows escaped tags in the error summary.

Screenshot 2025-09-03 at 10.31.08.png

Proposed resolution

Use FormattableMarkup when setting $element['#title'] to ensure HTML in field labels is rendered instead of escaped.

Implementation details

element['#title'] = new FormattableMarkup(element['#title'] . $suffix, []);

Testing instructions

You should have a multilingual site.

  1. Create if you don't have an image field in the user entity.
  2. Mark the field as non-translatable.
  3. Set a max file size for the image field.
  4. Try to upload a larger size image to trigger the error.

The error message should display the field label with rendered HTML, not escaped.

Merge request reports

Loading