Make default language required #1706
Replies: 4 comments 1 reply
-
Why would you consider this a bug? Let's flip this scenario: Would you like to be forced to create a "default", let's say english version of a page or a record which you need to be present in the specific language, not the default one? There are pages in site structure that make sense in DE and does not in EN. Would you like to be forced to create them both? |
Beta Was this translation helpful? Give feedback.
-
Ok, I get your point, but that only affirms my last point, to make the lagnuage selection/translation collection specific. If I set a field to "localized: true", I expect the user to at least fill out the default locale. It's also unintuive for the user to fill out some pages in both languages and some only in one. It would be much better if I could set the possible languages on a per collection basis. Then pages that only make sense in one language only have the option to be translated in one language. |
Beta Was this translation helpful? Give feedback.
-
Hey @johannesschaffer and @quornik — just putting out some thoughts here. Field vs. document-based localesWe deliberately adopted field-based localization for a lot of reasons. It's actually becoming the favored way of storing locales. Contentful and many others store locales based on field, which comes with a lot of benefits. There are lots of cases where data does not need to be localized, but it needs to exist in each locale — like But, if you want to localize documents on a field-level, you could easily do so by setting up your content model in a way that stores locales in that way using a Potential fixes, etc.I personally like the idea of automatically switching the user back to the default locale upon creating a new document, but this is not completely bulletproof as it does not restrict the creation of documents first in other locales outside the admin panel and via API. And enforcing that the default locale must be fully completed also fights against what @quornik is saying in that some pages may not need a default locale at all, and we actually see this quite commonly where a page only needs data in a given locale and not in the default locale.
@johannesschaffer I think you might mean on a After thinking through this with the Payload team this AM, I think there are options with custom components / hooks here but I am not sure that there is a specific solution that we could work into Payload's core. I will convert this to a discussion though and we can keep the conversation going there. If there is a bug, or something is broken, we can recreate an issue and it will get prioritized accordingly. 👍 Thank you for the conversation so far here. Super interesting! |
Beta Was this translation helpful? Give feedback.
-
Hi, @jmikrut!
I want to switch the user back to the default locale when user opens http://url/admin/collections/mycollection/create? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Bug Report
=> Not quite sure whether it's a bug, but given Payload's otherwise excellent handling of required fields, this behaviour seems kinda strange.
If I switch the langue to a non-default language (e.g. de) and create a new document, it lets me publish it without having filled out required fields in the default language
Other Details
Not quite sure, whether there is an easy solution for that, given that Payload can be used without the Draft's system.
Maybe make the language at least local to a document?, so when creating a document in en, then switching to de to edit it, then creating a new document, it will default back to en instead of staying in de.
Otherwise, at least a warning before publishing, that the default language has missing fields, would be nice (it's less about me, as a developer, having to deal with null exceptions, and more about the user, following the worklow described about, possible not being aware of the fact, that he didn't fill out the default language.
On a side note, I find it quite unintuitive, that the language switcher isn't scoped to the document, like in any other CMS.
Beta Was this translation helpful? Give feedback.
All reactions