Adding one photo. The name of the photo is example.jpg.
<img src="{{ asset('images/front/homepage/example.jpg') }}" alt="example">
Depending on the language, it needs to display a different name of the photo on the page. This cannot cause a photo display error. In Polish, the name should look like this: example-polish.jpg
<img src="{{ asset('images/front/homepage/example-polish.jpg') }}" alt="example">
I don't want to duplicate photos because it is a poor solution in terms of memory on the server.
How can I rename photos using translations in symfony?
Maybe I'm missing the point, but the file content stays the same right?
If it is for SEO purposes you should use the alt
-attribute for the translation
<img src="{{ asset('images/front/homepage/example.jpg') }}" alt="{{ 'translation'|trans }}">
or use <figure>
with <figcaption>
<figure>
<img src="{{ asset('images/front/homepage/example.jpg') }}" alt="{{ 'translation'|trans }}">
<figcaption>{{ 'translation'|trans }}</figcaption>
</figure>