Docs / Reference

Per-language images

Short answer: Eachlang can show a different image in each language. You choose which image replaces which, per language. A banner with English text, a screenshot of your English app or a product photo with an English label gets its French or German version on the matching pages. This is included in every paid plan.

What gets swapped

You give a list per language: this image → that image. Eachlang then replaces the address everywhere it appears on your translated pages:

  • <img> src and srcset (each srcset candidate is swapped on its own; 480w and 2x descriptors stay)
  • <picture> and <video> <source> src and srcset
  • video poster
  • <input type="image">
  • social preview images: og:image, og:image:url, og:image:secure_url, twitter:image
  • <link rel="preload" as="image"> href and imagesrcset

Images without an entry in your list stay exactly as they are. Image alt and title text is translated as usual.

These are not swapped today: lazy-loading attributes such as data-src, CSS background-image, and image in JSON-LD structured data. If your site uses them for an image you want to swap, use a plain <img>, or with the AI prompt setup, use img() in your code (below).

How addresses are matched

  • An entry can be a path on your site (/img/hero.png) or a full address (https://cdn.example.com/hero.png). The new image can be either too.
  • Query strings: an entry without a query matches every version of that image, so /img/hero.png also catches /img/hero.png?v=123. An entry with a query matches only that exact query.
  • A path entry matches images on your own site only, not the same path on another domain. For images on a CDN, use the full address.
  • Paths are case-sensitive: /img/Hero.png and /img/hero.png are different images.
  • Up to 500 entries per language.

DNS setup

Nothing to change on your site. Eachlang swaps the image addresses on your translated pages (fr.yoursite.com) when it serves them. After a change, translated pages show the new images within about 5 minutes.

AI prompt setup

Package: useImg() and makeImg() come with @eachlang/next and @eachlang/tanstack (npm i @eachlang/next or npm i @eachlang/tanstack); the setup prompt installs the right one.

Your translations already include the image list for each language. Wrap image addresses with img():

jsx
const img = useImg();
<img src={img('/hero.png')} alt={t('Our team at work')} />

img() returns the image for the current language, or the original address when there is no entry. It never throws. On the server, makeImg(getTranslations(lang).images) gives the same function.

You can also ask your coding agent: "Use Eachlang's useImg() for the hero image and the product screenshots, so each language can show its own version."

How to set it up

  1. Upload the translated images to your site or CDN, so each one has its own address.
  2. Send us the list: for each language, the original image address and the new one. Write to support@eachlang.com from your account's address and name the project. We set it up for you.

Moving from Weglot

If you swap images per language in Weglot ("Media translation"), make a list of those images before you cancel Weglot, then send it to us as above. Your translated pages show the same images on Eachlang.