I have a translation yml file like this:
tag:
myfirsttag: Tag number one
secondtag: Tag number two
....
and twig template like
<select name="tag" required="required">
{% for tag in tag_list %}
<option value="{{ tag }}">{{ "tag." ~ tag | trans(domain='mydomain') }}</option>
{% endfor %}
</select>
So here is the problem. Items in select are rendered like "tag.myfirsttag", not translated. If I replace "tag." ~ tag
with hardcoded string like "tag.myfirsttag"
it works well. So obviously it is related to concatenation but official docs doesn't say anything about it.
To be more clear and simple
I can translate
{{ "hello.world" | trans(domain='mydomain') }}
but can't translate
{{ "hello." ~ "world" | trans(domain='mydomain') }}
to translate contact strings you have to make this thing:
But try writing string to translate like params: eg:
Is it an associative array, right? Then you should be looping over key=>value pair
Or is your array deeper:
The solution is to put the string into parentheses as described here:
works:
doesn't work:
works: