Add an "existing translations" functionality to globals and collections #5617
Replies: 2 comments 1 reply
-
Yeah, this would be really helpful. The current philosophy with field based localization really only makes sense if every single doc and global has their translations from the start. But in reality this rarely is the case. I would even go a step further and consider a document only as existing translation if every field with the This would also help clean up the collection's list view in the admin panel with all the empty title fields. At the moment one would have to manually create these filtering rules for every collection and also keep those up-to-date when fields change. |
Beta Was this translation helpful? Give feedback.
-
+1, would love to have this, as I currently have to do manually To be honest, localization sometimes just does not make sense as it can return an empty document for some locale just because that locale was configured, even though it's missing all the fields. |
Beta Was this translation helpful? Give feedback.
-
It'd be useful to be able to know the existing translations of a Payload document, e.g. when generating hreflang tags. This could be done with a predicate function that the user provides, which determines whether a locale exists for a certain document or not.
Let's say I have a global and if that global's
content
field is not empty for a certain locale, I want it to count as having a translation in that locale. I could do it like so:Then, if my config looks like this:
…but my global's data looks like this:
…I'll be able to get the relevant translations like so:
This way I can avoid processing the
fr
andde
locales, as the document doesn't have translations in those.Beta Was this translation helpful? Give feedback.
All reactions