Problem/Motivation

In a label ' instead of ':
Views : filtrer par une vue d'entité référencée
french translation of
Views: Filter by an entity reference view

There is a double Html::escape and & is changed in &.
1) The first in lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php in function fieldSettingsForm,

    foreach (array_keys($selection_plugins) as $selection_group_id) {
      // We only display base plugins (e.g. 'default', 'views', ...) and not
      // entity type specific plugins (e.g. 'default:node', 'default:user',
      // ...).
      if (array_key_exists($selection_group_id, $selection_plugins[$selection_group_id])) {
        $handlers_options[$selection_group_id] = Html::escape($selection_plugins[$selection_group_id][$selection_group_id]['label']);
      }
      elseif (array_key_exists($selection_group_id . ':' . $this->getSetting('target_type'), $selection_plugins[$selection_group_id])) {
        $selection_group_plugin = $selection_group_id . ':' . $this->getSetting('target_type');
        $handlers_options[$selection_group_plugin] = Html::escape($selection_plugins[$selection_group_id][$selection_group_plugin]['base_plugin_label']);
      }
    }

With two lines with Html::escape.

2) The second in lib/Drupal/Core/Template/TwigExtension.php in function escapeFilter,

    if (isset($return)) {
      if ($autoescape && $return instanceof MarkupInterface) {
        return $return;
      }
      // Drupal only supports the HTML escaping strategy, so provide a
      // fallback for other strategies.
      if ($strategy == 'html') {
        return Html::escape($return);
      }

It's not a translation problem since the change of the original label produce the same problem.

Steps to reproduce

- Use an other language like french.
- Create a field of type Entity Reference Revisions.
- Edit the field.
- Into the form Reference type>Reference method see the translation of
Views: Filter by an entity reference view

In fact, put an apostrophe ' in a translation of a label of this form.

Other similarly case:
- Add the module paragraph.
You should have a new enter in the form: Default.
- Put a ' in its translation.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

Chris64 created an issue. See original summary.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

This came up as a daily BSI target

On 11.x I can confirm the issue still exists

bug

This will need an IS update when a proposed solution is made and will need test coverage.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.