Hey guys,
I have a bunch of localized fields but there's one particular query where I need to get all available translations. The page slug
. The reason being is I need to provide alternate language URLs and allow the user to switch between languages and each document can have multiple languages with independent URLs.
Currently the only way I can see to do that is loop over all available locales and query for each document of that locale to find out if it exists.
Is there any way for me to do that directly via the API? I couldn't see anything in the docs.
Hey @richardvanbergen —
We do have a way to do this!
?locale=*
Somehow that went un-documented. It only works via the REST API for now, because of GraphQL's strongly typed nature. Enabling this in GraphQL would mean that we have to make a whole other set of queries, which is possible, but likely lower on our priorities list.
We will get our docs updated ASAP. Give it a shot!
Thanks! It works quite nicely. 🙏
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.