I'm having trouble to translate a string in Twig. I'm building a theme for a multilingual webshop.
A user can create a USP (Unique Selling Point). Problem is that it won't translate when you have a different language.
So the usp is called like this in the template {{ theme.usp }}
The outcome of that is for example "Free shipping".
To translate a string in the system you have to use a {{ 'Free shipping' | t }}
filter.
Is there any way to get {{ theme.usp }}
translated. I thought this would be useful but I don't know how to incorporate this. How to concatenate strings in twig
What I did was:
{% set usp = {{ theme.usp }} %}
{{ usp | t }}
Doing this gives me an error since {{ theme.usp }}
has to be between ''
. Doing that doesn't gives me 'Free shipping'
as outcome but 'theme.usp'
.
Anyone a suggestion?