If I happen to create this page when in the secondary language, this field is created without the default value.
I understand this is because it is set as translate: false, but it does not make a lot of sense from the user perspective, who wants the field to be non-editable in the secondary language, but still expects the default to be applied in all cases.
Have you actually checked what happens if the field is not set to translate: false? Is the default value then nevertheless stored even if the page is created from a secondary language?
In all cases (no matter the selected language in the panel when creating the page) the text file created belongs to the first language, in this case: work.es.txt
If the fields are translate: false, the default value is NOT applied and the field is NOT registered at all in the text file.
If the fields are translate: true, the default value IS applied and so the field IS registered correctly in the text file.
Yes, Kirby always creates the default language text file first.
I actually think if the value is stored in the default language when translate is false or not set, then the same logic should also apply when the translate: false is set.
Just run into this bug too… I want to create a page in the default language from the frontend. when the user visits the page in the default language, everything is find. but if the user’s on an other language, it creates the page with in the default language, but all fields with “translate: false” remain empty.
I only need the created page in the default language and don’t want to translate any of the fields.
how can I achieve that?
Could you post the code that handles this form submission? Maybe if you call $site->visit($page, $lang) before creating the new page, you can work around this issue.
Thanks alot @texnixe. $site->visit($page,$lang) works fine. But I have to redirect the user afterwards back to its language.
Is it better to use $site->visit($page,$orgLang) again or is $page->url($orgLang) fine?
I create the pages with $parent->createChild() and just found out, that there is a $lang param/prop for that method. So using $page->createChild([...],$lang) works as well.
Would be nice if that could be added to the documentation.
^ I’m so stupid… if you exclude the translate:false in the blueprint it works in every case. this method doesn’t work. But the above with $site->visit($page,$lang) is the way to go.