Translate: false is null when in structure type

Hey there!

My blueprint looks as follows:

  entries:
    label: Entries on the Home page
    type: structure
    style: table
    fields:
      title:
        label: Title
        type:  title
        width: 1/2
      pic:
        label: Cover Image
        type: image
        width: 1/2
        translate: false

In the default language i can choose the image. When changing to another language, the field is disabled as wished, but it’s not saving the default language selection, but saves “null” instead.

Yes, that is ok, because untranslated fields get their value from the default language.

Yeah that’s what i expect it to do, but when i try to get the “pic” image from the structure field in a not translated language, it stays empty in frontend. :wink:

Maybe it’s a problem with structures?

The problem was already described here: Strange structure behaviour in 2.3.2

The fallback works if you set the complete field to translate: false, not just a field within the structure. For a subfield based translation fallback to work, the Panel would have to store the values of the default language in all non-default languages. But I’m not sure this would make sense, considering that you can remove entries from a single language but not the others with such a setup or reorder them. This would all end up in a big mess, I think.

In your particular case you can probably work around this issue if you set the title as image meta data and make the complete field untranslatable (so that you would only select the images to be used and their order in the default language). In that case you can then opt for another field type (for example, the images plugin) instead of the structure field.

Or maybe you can describe your exact use case so that we can try to find a better solution.

Edit: If your structure field contains sections for the home page, consider using subpages or modules. To make handling of these subpages/modules easier, you can use the index. field or the sortable field.

2 Likes

Hmm… thanks, @texnixe!
So i guess since this isn’t fixed for two years, this behaviour is intentional?
I think, the easiest way for me is that i have to simply set the pic as translateable and
choose the picture for every language. :slight_smile:

Or you could check if the image is set in the current language and if not, manually go and fetch the one from the default language. It’s a bit more work but at least you don’t have to manually set the same image for each language :wink:

This is probably tricky, because there is no easy way to identify the same entry in another language. They could be in a different order, they have different titles…

Really? Maybe I think the problem is easier than it is then. Let me give it a try…

In addition to the fact that something I thought was possible is actually not, I see your point. If @RastaTux has different titles and positions of the items inside the structured field there’s really no way to do this unless he adds some sort of extra field to use as ID.

But I think this makes everything extra complicated.