Skip to main content
[StoryblokStoryID:245122201]

Live article: https://www.storyblok.com/faq/querying-multi-language-content-with-the-graphql-api


  • FAQ
  • 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.

Copy to clipboard
        
      {
  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.

Copy to clipboard
        
      {
  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.