Problem with bracket syntax for arrays in twig

Created on 14 February 2025, 3 months ago

Problem/Motivation

We have the problem that the following kind of notation within a twig script is extracted in a wrong way:
Any text {{ item.content['#markup'] }}

The extracted value then looks as follows:
Any text @item.content

As you can see, the #markup is not mentioned at all and therefore the translation does not work. I would have expected the following extraction:
Any text @item.content.#markup

I tested further and found out that the bracket notation is fully ignored by the extractor. Thus, when changing the above notation to
Any text {{ item[content]['#markup'] }}
the extracted value is just
Any text @item .

Steps to reproduce

Use the bracket notation within a twig instead of the dot notation.

Proposed resolution

As this kind of notation is valid for twig, this should be fixed here.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇩🇪Germany juliaschwarz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024