{% trans %}<span class="by-author">by {{ author_name }}</span> {{ created_date }}{% endtrans %}

It gives the following error when importing translations.
Import of string "<span class = "by-author">@author_name </span> от @created_date" was skipped because of disallowed or malformed HTML.

Comments

Chi created an issue. See original summary.

jungle’s picture

jungle’s picture

Same twig markup exists in both core/profiles/demo_umami/themes/umami/templates/content/node--article--full.html.twig and core/profiles/demo_umami/themes/umami/templates/content/node.html.twig.

markconroy’s picture

Hi @Chi and @jungle

Thanks for reporting this issue; it looks very interesting. Can you provide steps to reproduce this? I presume it's when you use the UI to add a new language?

I wonder is the issue because of the custom {{ created_date }} variable that we created, rather than using {{ date }} like in the other node.html.twig templates? Perhaps it has something to do with that being defined within the node* templates in Umami rather than being done in a preprocess function somewhere else. I'm not sure, that's just a hunch.

chi’s picture

Status: Active » Closed (cannot reproduce)

The error occurs because of spaces in class attribute. I've just downloaded the translation file again and it does not contain these spaces. Not sure how I got them initially.

chi’s picture

However I think having CSS classes inside translatable string is not a good idea. But that's a different issue.

markconroy’s picture

Thanks for checking back on that for us @Chi. We appreciate it.