Problem/Motivation

Self closing br tags are not allowed in translation import, therefore usage in t() breaks translation workflow, since translators tend to copy&paste the translation strings, leaving tags in place.

Proposed resolution

Replace <br/> with <br>.

CommentFileSizeAuthor
#2 3037353.patch14.38 KBvolkerk
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

volkerk created an issue. See original summary.

volkerk’s picture

Issue summary: View changes
FileSize
14.38 KB
volkerk’s picture

Status: Active » Needs review
gbyte’s picture

Status: Needs review » Postponed (maintainer needs more info)

Why is it not allowed, what's wrong with it? Any documentation you can point me to?

volkerk’s picture

Status: Postponed (maintainer needs more info) » Needs review

Translated strings are validated by locale_string_is_safe() on import, self closing br without whitespace will fail because XSS::filter will add whitespace, see #953582: locale_string_is_safe() will not allow self-closing tags without whitespace.

I moved directly to simple <br> because html5 does not have a 'self closing tags' pattern, see reasoning in #1388926: Remove all references to "self-closing" void elements in core.

Anyway, using <br/> renders adding translations for these strings impossible.

  • gbyte.co committed 9c45e4e on 8.x-3.x
    Issue #3037353 by volkerk: Self closing br not allowed in translation...
gbyte’s picture

Status: Needs review » Fixed

Thanks for looking into this.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.