Add an "existing translations" functionality to globals and collections #5617
hdodov
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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