Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
One of the strings in block_content_help has malformed HTML - <a/>
instead of </a>
.
$output .= '<p>' . t('The Custom Block module allows you to create and manage custom <em>block types</em> and <em>content-containing blocks</em> from the <a href = ":block-library" >Custom block library</a> page. Custom block types have fields; see the <a href=":field-help">Field module help</a> for more information. Once created, custom blocks can be placed in regions just like blocks provided by other modules; see the <a href=":blocks">Block module help</a> page for details. For more information, see the <a href=":online-help">online documentation for the Custom Block module</a>.', [':block-library' => \Drupal::url('entity.block_content.collection'), ':block-content' => \Drupal::url('entity.block_content.collection'), ':field-help' => \Drupal::url('help.page', ['name' => 'field']), ':blocks' => \Drupal::url('help.page', ['name' => 'block']), ':online-help' => 'https://www.drupal.org/documentation/modules/block_content']) . '</p>';
Proposed resolution
Fix malformed HTML.
Remaining tasks
As above.
User interface changes
New string will get new ID on localize.drupal.org. We would have to wait for tagged release to translate new string and start propagating translation to all existing D8 instances.
API changes
No.
Data model changes
No.
Comment | File | Size | Author |
---|---|---|---|
#2 | malformed_html_in-2871097-2.patch | 2.55 KB | zaporylie |
Comments
Comment #2
zaporylieHere's a patch which replaces
<a/>
with</a>
.Comment #3
LoMo CreditAttribution: LoMo as a volunteer commentedGood catch... and given that the malformed HTML is a bigger issue than the need for fixing the translation of same, I'd argue that it might better be fixed now, rather than waiting for the 8.4 release. I don't think fixing this is particularly disruptive compared to the benefit of fixing it and it would mean that any translations of this string that are made between now and then would not be broken (at a later time).
I hesitate to change the "version" selector, but I really do think that it's more appropriate to commit this bugfix earlier than the next major release, rather than wait just because of the translation issue.
Anyway, I think this looks safe to mark as RTBC. :-) (Note that the code copied to the issue description already has the correction applied, so might be confusing to people who are looking for the problem. ;-) )
Comment #4
tstoecklerSomeone more knowledgeable with the Locale / Potx / l.d.o setup should confirm this, but as far as I know strings with invalid HTML are ignored the translation extractor anyway, so this would actually be a string addition, not a string change.
Fix looks good by the way.
Comment #5
LoMo CreditAttribution: LoMo as a volunteer commented@tstoeckler
I think that only strings which include disallowed HTML tags are not extracted. (Edit: I looked at the corresponding de.po file and found that string does not exist at all—and there are many untranslated strings, so I assume you are right and the translation, below, found in the es.po file was manually added. Seems like the Spanish translation team has covered almost everything, including fixing this malformed HTML in their translation.)So I still think it's better to fix it earlier than wait for many other languages to have a translation of this malformed HTML. I'll change the target to 8.3.x-dev and see what core committers think about this instance.
This is an excerpt from the drupal-8.3.0.es.po file currently available on https://localize.drupal.org/download:
Comment #6
LoMo CreditAttribution: LoMo as a volunteer commentedChanging target for delivery of this fix to the current dev branch (8.3.x-dev), since the affected string is not automatically parsed and this change should not affect many translations. Hopefully we can just fix the few translations that would be affected (ones where this string was manually added by a translation team).
Comment #7
alexpottCommitted and pushed 38c553d to 8.4.x and 3ec9fb5 to 8.3.x. Thanks!
Since this is a bug fix we need to fix this in 8.3.x - normally we don't change translatable strings in a patch release. Nice discussion and sleuthing of the backportability @LoMo.
Comment #10
LoMo CreditAttribution: LoMo as a volunteer commented@alexpott Great! I've gone ahead and downloaded other larger .po files and searched them to see which of the other very active translation teams had already translated (and corrected) that string and found eight other languages besides Spanish, so I'll go ahead and contact an active member on each of those nine translation teams to let them know that the "new string" is already translated. That should help minimize the disruption that back-porting this fix might cause. ;-)
Comment #11
zaporylie@LoMo Polish translation team is already aware of this change
@alexpott Thanks!
Comment #12
LoMo CreditAttribution: LoMo as a volunteer commented@zaporylie Oh, of course... I didn't think of that, but it's not surprising, given you reported and fixed this. ;-)
That said, I did contact someone on the .pl translation team who appeared to be active (just so that they would know that this had been committed and would break translations of the malformed string... and to help make sure nobody spent time re-translating when the "new string" appeared).
Comment #14
zaporylieUnfortunately string still contains invalid characters (whitespaces). I created follow-up issue and provided a patch - #2877851: String contains malformed HTML