Querying multi-language content with the GraphQL API

If you want to get field-level translations in our GraphQL Api, you have to query the language directly on the field. See the result by copying the following code snippets into our GraphQL Explorer example.

{
  Space {
    languageCodes
  }
  PageItems(starts_with: "es/*") {
    items {
      lang
      content {
        body
        option(language: "es") {
          lang
        }
      }
    }
  }
}

Use the starts_with parameter on the top level and language on stories that are referenced through option fields.

{
  PageItem(id: "es/about") {
    id
    lang
    name
    content {
      option(language: "es") {
        lang
      }
      body
    }
  }
}

For a specific content item, you need to prepend the language on the id and use the language parameter on referenced stories.