Structure field entries dissappear when switching languages

I have the feeling this happened before.

In the default language I add an entry to a structure field.
I then switch language and that entry is not there.

Many other entries do show when switching langs. But after a certain moment in time, they don’t anymore.

This happens in more than one page/structure

I may have changed locales in the php files at site/languages/ at some point, May it be related? I tried returning the locales to the values they had before, but still… disappearing structure entries.

I can add them separately in each language tho.

Would be great to fix

Thank you

I’m not sure I understand the problem completely. Are you talking about structure fields without any entries in a newly created page? Or when you add entries to an existing page when there are already entries?

Edit: This topic is already categorized as solved but without any explanation?

The topic was wrongly categorized, sorry.

There is a site near completion with several panel pages which have structure fields.

We’ve been adding entries to these fields for a while. We added entries in the default lang (es_MX) , switched to the other lang (en_US) and translated the entries we just added.

At some point in time we added some entries, switched languages and the entries were not there, switched languages back, the entries were there.

This now seems to happen in all or most pages with structure fields. Any newly added entry is not added to the secondary language by default.

As mentioned, at some point I changed how locales appear in the lang config. For some reason I had them as such:

return [
    'code' => 'en',
    'default' => false,
    'direction' => 'ltr',
    'locale' => [
        6 => 'en_US'
    ],
    'name' => 'English',

When I saw that 6 in the locale array I though that was a mistake and removed it as such:

 'locale' => 'en_US'

I am unsure if this caused the problem, but just in case I rolled back to the weird syntax with the 6 but that did not solve the problem.

I also tried to edit the files manually to add the missing items, and that is allright, but that did not solve the problem for newly added items.

Thank you

I don’t think newly added items appeared in the secondary language ever. That’s not how it is supposed to work once a field is translated.

1 Like

You can see the contents of the default language in a translated page as long as there is no content file created for this language yet.

Changing the slug, title or basically anything in a page translation will create the content file with the current content of the default page though. If this happens before you added all the structured data in the default language you will have this issue.

Ah I see, that explains it. Thank you @texnixe and @lukaskleinschmidt