Repository navigation
Should Markdown UI elements support translations? #20408
|
Currently, the Markdown UI element in the Field Layout Designer does not seem to support translations through Craft's standard translation files ( Unlike field labels, instructions, tips, and warnings, the Markdown element's content appears to be rendered directly without passing it through I use Markdown UI elements to display contextual information to content authors within field layouts. I deliberately prefer Markdown over Tip or Warning elements because I want to display this information without the additional visual styling (colored backgrounds, icons, etc.). For multilingual projects, it would be useful if these explanatory texts could be translated just like other field layout UI strings. Am I missing something here? Perhaps there is already a recommended or more appropriate way to translate the content of Markdown UI elements that I'm not aware of. If not, would it make sense to add translation support for Markdown UI elements, for example by passing their content through I'd be interested to hear whether this is intentional behavior or whether translation support would be a useful addition to Craft. |
Replies: 2 comments
|
You are not missing anything. The Markdown element does not run its content through the translator today.
cms/src/fieldlayoutelements/Markdown.php Lines 103 to 110 in 3419773 The other elements you mention do translate against the
I can't tell from the code whether leaving Markdown out was deliberate or just missed. The change you suggest would be small: wrap the content in Until then, the closest option I found in the code is the Template UI element. It renders a Twig template from your cms/src/fieldlayoutelements/Template.php Lines 107 to 109 in 3419773 (I looked this up in the code with help from an AI assistant; the links are to the lines I checked.) |
|
Yeah that was overlooked. Fixed for the next release: 5cff5ed |
Yeah that was overlooked. Fixed for the next release: 5cff5ed