Localized image in multilingual leaf bundle?

I may be missing something obvious, but I’m a little confused about multilingual images in a leaf bundle.

On the Multilingual doc page it says

Page Bundle’s resources follow the same language assignement logic as content files, be it by filename (image.jpg, image.fr.jpg) or by directory (english/about/header.jpg, french/about/header.jpg).

I have a leaf bundle with

  • index.en.md
  • index.es.md
  • image.jpg

The EN build directory contains

  • index.html
  • image.jpg

I thought that if I added image.es.jpg that it would replace image.jpg in the ES build. Instead, the ES directory contains

  • index.html
  • image.es.jpg

If I have a leaf bundle file named image2.es.jpg (without a file named image2.jpg), then image2.es.jpg ends up in both builds.

Is there a way to have bundle images ending in .es.jpg only used in the ES build?

And is there a way to have them renamed without the .es, so that .md files can simply refer to “image.jpg”, no matter what the language?


The doc says:

If, across the linked bundles, two or more files share the same basenname, only one will be included and chosen as follows:

  • File from current language Bundle, if present.
  • First file found across bundles by order of language Weight.

I’m trying to figure out if what you describe follows that. Is your site available somewhere? Or could you make a minimal example repo we can clone?

See https://gitlab.com/stop-fossil-fuels/stop-fossil-fuels-test

The leaf bundle is in content/spread-strategy/printed-material/

Build the site, then compare

  • public/en/spread-strategy/printed-material/
  • public/es/difusion-estrategia/materiales-impresos/
  • public/ru/spread-strategy/printed-material/

EN is as expected, with zine.jpg

ES may be as expected, with zine.es.jpg. I expected this file would be renamed to zine.jpg, but perhaps that’s not how it’s supposed to work.

RU really confuses me. Even though English has the lowest “weight” value, RU has zine.es.jpg instead of zine.jpg. This seems to contradict “First file found across bundles by order of language Weight.”

I opened an issue at https://github.com/gohugoio/hugo/issues/5794