Field data in multilanguage websites

Either my brain is not working correctly at the moment, or I didn’t understand it properly…

For example, my project is multi-language and I have a field:

footerCustomCode:
    label: Footer custom code
    type: code-editor
    size: medium
    width: 1/2

And on frontend

<?= $site->footerCustomCode()->value() ?>

If I add content in the field in the default language and save, that code is also visible in that field on the secondary language (which was empty before), in the panel. But it is not visible on the frontend.

Only after I change that code in the secondary language, only then the code is visible on the frontend.

Now, this is a bit confusing for me, because I expected field values from the default language to act as fallback values for secondary languages, if field values in secondary languages are empty.

Is this expected behavior or maybe a bug?

What is stored in the non-default language for that field in site.xx.txt, if anything?

Nothing, value is empty.

However, in the panel, at secondary language page, the value from the default language is displayed in the field.

Then it should also show up in the frontend, but in my test, if the field key is present in the site.secondaryLangCode.txt file, that fallback stopped working. That’s why I was asking what is store in the site.xx.txt file, not only the field.

1 Like

Hi Sonja, sorry for the delay.

I understand now, yes.
Default language is a fallback if the secondary language field hasn’t been modified. But once it is modified, default language field is no longer a fallback.

My issue was… I allowed users in Zero One to add custom code in all languages (without translate: false), and I wanted to disallow that and allow only custom code in the default language. But that’s not a good idea now.

It could be ok if I had made it that way from the beginning, but now it is not ok, because if users have already changed custom code in a secondary language, they will not get the custom code from the default language in secondary languages. And if they added something to the secondary languages custom code, they wouldn’t be able to delete it.

Thank you very much, as always you are more then helpful :folded_hands: