Problem/Motivation
Invalid HTML is included in the translatable string referenced below:
This causes "String import failed" error when importing translations.
<?php
$form_state->setErrorByName('connection_settings', $this->t('Failed to connect to the server. The server reports the following message: <p class="error">@message</p> For more help adding or updating code on your server, see the <a href=":handbook_url">handbook</a>.', [
'@message' => $e->getMessage(),
':handbook_url' => 'https://www.drupal.org/docs/extending-drupal/overview',
]));
?>
Seems like <code>locale_string_is_safe()
does not allow p
tag in translatable strings.
Per Gábor Hojtsy and examples in Drupal Core itself, the paragraph tag is allowed in translatable strings, so the cause of the issue here may be misidentified above.
Steps to reproduce
This issue is very difficult/potentially impossible to reproduce at this point because the form UI was removed in this issue: https://www.drupal.org/node/3502973
Proposed resolution
The module that contains this bug is depricated and scheduled to be removed in Drupal 12. Reference: https://www.drupal.org/node/3512364 and https://www.drupal.org/project/drupal/issues/3491731
Remaining tasks
N/A
User interface changes
N/A
Introduced terminology
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A