Skip to content

25 · Gettext import silently drops translations containing <u>, although CKEditor 5 produces it

Project Drupal core
Component locale.module
Category Bug report
Priority Normal
Status Draft, not filed on drupal.org yet

Problem/Motivation

locale_string_is_safe() uses an allow-list of HTML tags that does not include <u>. CKEditor 5 produces <u> for "Underline". Translations of such strings are skipped during a Gettext import without any message. Example: a text in the Mercury Demo site template.

Steps to reproduce

  1. Create a .po file with a msgid/msgstr containing <u>…</u>.
  2. Import it → the string is not imported, no warning is shown.

Proposed resolution

  • Add <u> to the allow-list (it is not dangerous), and/or
  • report skipped strings during import.

Additional information

A similar case: a string with a javascript:// link in the AI module is skipped (see the separate issue).

Copy to drupal.org

Issue title:

Gettext import silently drops translations containing <u>, although CKEditor 5 produces it

Issue summary (paste it into the "Issue summary" field; project, component, category and priority are in the table above):

<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p><code>locale_string_is_safe()</code> uses an allow-list of HTML tags that does not include <code><u></code>. CKEditor 5 produces <code><u></code> for "Underline". Translations of such strings are skipped during a Gettext import without any message. Example: a text in the Mercury Demo site template.</p>
<h3 id="summary-steps-reproduce">Steps to reproduce</h3>
<ol>
<li>Create a .po file with a msgid/msgstr containing <code><u>…</u></code>.</li>
<li>Import it → the string is not imported, no warning is shown.</li>
</ol>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<ul>
<li>Add <code><u></code> to the allow-list (it is not dangerous), and/or</li>
<li>report skipped strings during import.</li>
</ul>
<h3>Additional information</h3>
<p>A similar case: a string with a <code>javascript://</code> link in the AI module is skipped (see the separate issue).</p>