I’m pretty new to GraphQL as well as squidex, so please bear with me if this is obvious:
I have two language defined in squidex. And I have defined a field as localizable and provided the two languages to my content instances.
With GraphQL: how can I retrieve the content for a given language without writing different GraphQL queries for all my languages?
E.g. for a query like the following:
query Posts {
queryPostContents(filter: "data/tags/iv eq 'forDev'") {
data {
text {
en
de
}
}
}
}
If I had to rewrite this query for every language I would end up with something like:
...
text {
en
}
...
and
...
text {
de
}
...
Which makes the code unmaintainable and also poses problems when parsing the data (I am using apollo-android) as I would have to use reflection to get the right variable name from the generated type. I recognize that flatData
would solve the latter problem, but then I could not define the language in the query anymore (I like would have to put it somewhere in the filter?).
I’m pretty sure I’m just overlooking some simple solution here as this seems to be a pretty common use-case, but I neither could find it here in the forum or on the internets.