Query by language

If you are taking advantage of the localization feature in your Prismic repository, then you'll need to be able to query documents for a specific language.


Query documents in all languages

By default, the Prismic GraphQL API will return documents in all the languages configured in your repository. You do not need to add anything to your query to retrieve all the languages:

Copy
query{
  allPages{
    edges{
      node{
        title
        _meta{
          lang
        }
      }
    }
  }
}

Query documents of a certain language

If you only want to retrieve documents for a particular language, simply add the lang argument and set it to the language code you want.

This is an example of how to retrieve all the document of the type "page" in Traditional French ("fr-fr"):

Copy
query{
  allPages(lang:"fr-fr"){
    edges{
      node{
        title
        _meta{
          lang
        }
      }
    }
  }
}