# General Translation Integrations: Querying translations
URL: https://generaltranslation.com/en-GB/docs/integrations/sanity/guides/querying-translations.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: How to query document-level and field-level Sanity translations with GROQ.

General Translation supports two Sanity storage models. Document-level localisation creates a document for each locale, while field-level localisation stores locale values in internationalised arrays in a single document.

## Query document-level translations [#documents]

Document-level translations are tagged with a language field, which defaults to `language`. Query the version you need by filtering on that field.

### Query source content

Source documents do not set the language field by default. Exclude translated documents by filtering for an undefined language field.

```text
*[_type == "article" && !defined(language)]{
  title,
  slug,
  body
}
```

### Query a target locale

Filter by the language field.

```text
*[_type == "article" && language == "es"]{
  title,
  slug,
  body
}
```

### Query a translated document

```text
*[_type == "article" && slug.current == "hello-world" && language == "es"][0]{
  title,
  body
}
```

If you dedupe translated slugs, the slug includes the locale suffix, such as `hello-world-es`.

### Query all language versions

```text
*[_type == "article"]{
  title,
  slug,
  body,
  language
}
```

### Query source content with or without a language field

Some source documents explicitly set the source locale while others leave the language field undefined. Include both representations when you need all source content.

```text
*[_type == "article" && (language == "en" || !defined(language))]{
  title,
  slug,
  body
}
```

### Use a custom language field

If your plugin config sets `languageField: 'locale'`, query `locale` instead of `language`. The schema field and the query field must match the configured value.

```text
*[_type == "article" && locale == "es"]{
  title,
  slug,
  body
}
```

### Query translated references

Reference patching updates the translated document&#39;s draft, creating one from the published state when needed. Publish the patched draft before querying the published version. The translated document then points to translated versions of referenced documents.

```text
*[_type == "article" && language == "es"]{
  title,
  "author": author->{
    name,
    language
  }
}
```

(See [Patch references](/docs/integrations/sanity/guides/managing-translations#patch-references) for how references are rewritten).

## Query field-level translations [#fields]

Field-level localisation stores each locale in an `internationalizedArray*` field. Filter the array by its `language` property and project the matching `value`:

```text
*[_type == "article"][0]{
  "titleEs": title[language == "es"][0].value,
  "bodyEs": body[language == "es"][0].value
}
```

The document itself does not receive the document-level `language` field or a `translation.metadata` link. Query other non-localised fields from the same document as usual.

## Next steps

- /docs/integrations/sanity/guides/translating-content
- /docs/integrations/sanity/guides/managing-translations
- /docs/integrations/sanity/guides/configuring-sanity

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
