---
title: "validate"
description: "Check every translation record against its source segments before it reaches your site."
canonical_url: "https://diglot.sh/workflow/cli/validate"
---
# validate

> Check every translation record against its source segments before it reaches your site.

`diglot validate` reads all records of each locale and checks them against the segments in the manifests. Run it in CI or after editing records by hand to catch a translation that would be rejected when applied.

```bash
pnpm dlx @diglot/cli validate [--locale fr] [--json]
```

## What it checks

For every record, the command verifies that:

- The record parses: its shape is valid, and its file name and directory match its hash.
- The hash is the hash of the record's `source` skeleton, for the formats the segment is used as.
- The translated `text` is valid for every kind and format in which the manifests use that hash. A hash can appear as a paragraph in one file and a list item in another, and the text must work for both.

A record whose hash no manifest uses produces the warning `not used by any source`. Warnings such as repeated code placeholders are reported too, and neither affects the exit code.

## Options

<table>
<thead>
  <tr>
    <th>
      Option
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --locale
      </code>
    </td>
    
    <td>
      all locales
    </td>
    
    <td>
      Check only this locale
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --json
      </code>
    </td>
    
    <td>
      off
    </td>
    
    <td>
      Print <code>
        { checked, errors, warnings }
      </code>
      
       as JSON
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --cwd
      </code>
    </td>
    
    <td>
      <code>
        .
      </code>
    </td>
    
    <td>
      The translations repository root
    </td>
  </tr>
</tbody>
</table>

## Output and exit code

Each issue is printed with its locale, hash and message, followed by a summary:

```text
error fr 87ecf1244d975205: paragraph: {1} is missing
1 records checked, 1 errors, 0 warnings
```

The hash and message above are examples of the format. The command exits with code 1 when there is at least one error. Run `extract` first, because validation reads the manifests. See [validation](https://diglot.sh/core/validation) for the list of issue codes.


## Sitemap

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