We’re looking for a new way to create multi language email templates. We got the idea to use inky in twig to create clean email HTML and render translations. The problem is that we have Sendgrid (handlebars) that renders variables the same way as twig.
Is there a solution to create a translation in twig having the {{ }} intact. We don’t want to translate around the brackets because that could not be compatible with the language its spelling.
example
{% trans %}I am a {{ job }}{% endtrans %}
gives the following error:
A message inside a trans tag must be a simple text.
2
Answers
You can use the verbatim tag to escape twig delimiters (or
raw
in twig 1 and 2).Another simple way would be to just output your twig delimiters as a string :
You could simply fix this by using the filter option: