Text.html.twig - different image on language

Hello,
text.html.twig contains the reference to the first image:

{% set image = page.media.images|first %}

is it possible to change it so that the image can change with the language extension?
Example: it should use image.en.png for English, image.it.png for Italian

page.media.images is just an array of all the images found in a particular folder. So getting |first will get whatever it finds first, irrespective of language.

If you want to get a particular language version of an image you’ll have to employ some logic:

 {{ set image = page.media.images['image.'~grav.language.getActive~'.png] }}

Thank you Andy, I had to change it a bit to make it work:

{% set image = page.media.images['image.'~grav.language.getActive~'.png'] %}

to keep it meaningful (not just image.en.png), I decided to get the filename from an header parameter, writing .en / .itdirectly in the name:

{% set image = page.media.images[page.header.image~'.png'] %}
---

Oh yah i had a missing single quote! sorry about that. Glad you got it sorted!