Hello everybody,
I am learning Directus atm using Astro and the SDK. One thing I can’t get done is reading translations from a collection using Deep or without directly accessing them using the *_translations collections that are auto generated and having them set to read as well.
Question: Is there a better way to read translated content from my globals collections? Can I somehow query the translated content through the “globals” singleton using the deep feature of the SDK?
const globals = await directus.request(readSingleton("globals"));
const content_de = await directus.request(
readItems("globals_translations", {
filter: { languages_code: { _eq: "de-DE" } },
})
);
const content_en = await directus.request(
readItems("globals_translations", {
filter: { languages_code: { _eq: "en-US" } },
})
);
---
<Layout>
<div>
<Header title={globals.title} description={globals.description} />
<Main>
<p>{content_de[0].content}</p>
<div>{content_en[0].content}</div>
</Main>
<Footer />
</div>
</Layout>
thanks