2

I am trying to access the nested paragraph field inside my twig template.

{% for items in item['#paragraph'].get_aw_title_details%}
  {{ item.entity.field_award.value }}
{% endfor %}

When I am using this syntax it is always returning the English content. Translation content is not visible for me. For chinese also it is giving the english content

1 Answer 1

4

Normally it's a better idea to process (or even better let Drupal process) the field values in PHP.

If there is no other way you can use Twig Tweak and its newly added entity translation filter:

{% set entity = item.entity|translation %}
{{ entity.field_award.value }}

See https://git.drupalcode.org/project/twig_tweak/-/blob/3.x/docs/cheat-sheet.md#entity-translation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.