Active
Project:
Drupal core
Version:
main
Component:
render system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 May 2026 at 17:37 UTC
Updated:
14 May 2026 at 17:37 UTC
Jump to comment: Most recent
Say I want to do something like this:
t('<span class="@class" title="Translatable title"></span>')
So I read the FormattableMarkup::placeholderFormat() doc to choose the correct placeholder type:
The doc says I should not use @ or % in attribute values.
It also says that : is only for href attributes.
So I'm left with no recommended solution.
Should I give up on having a dynamic value for this attribute? Should I try to escape it myself?
IMHO this is bad DX and could lead to some developpers not escaping attributes correctly.
Document the correct solution for this use case.
Comments