Initial data (simplified):
- Env with 2 locales: default (en) and additional (fr)
- Content Type “page” with 3 text fields (A, B and C) which are all translatable.
- An entry of “page” Content Type where
** Field A (en) == ‘test’
** Field A (fr) == ‘’ (empty)
** Field B (en) == ‘English text’
** Field B (fr) == ‘French text’
** Field C (en) == ‘More English text’
** Field C (fr) == ‘More French text’
Is it possible to create a graphQL query which will fetch pageCollection with FRENCH translations but to make a filter like [Field A (en) == ‘test’]?
My query:
query ($locale: String, $fieldA: String) {
pageCollection(where: { fieldA: $fieldA }, limit: 1, locale: $locale) {
items {
fieldA
fieldB
fieldC
}
}
}
- Using it with variables { locale: “en”, fieldA: “test” } - I get an entry with English texts (as expected)
- Using it with variables { locale: “fr”, fieldA: “test” } - I get NO ENTRIES as my fieldA (fr) field is empty. (as expected…
)
Is it possible to modify my query and\or params to get FRENCH texts but filtering entry by (EN) value of the fieldA, not the (FR) value?
Thank you in advance!
PS: I know that this case is solvable with REST API. But the question is within a scope of graphQL queries.