---
title: "Configure diglot"
description: "Set the locales, parser, output directories and machine translation options in diglot.config.ts."
canonical_url: "https://diglot.sh/guide/how-to/configure"
---
# Configure diglot

> Set the locales, parser, output directories and machine translation options in diglot.config.ts.

Everything about a translations repository that isn't a source or a locale file lives in `diglot.config.ts`. The CLI and the Action load it from the working directory, trying `diglot.config.ts`, `diglot.config.mts`, `diglot.config.js` and `diglot.config.mjs` in that order. Without a config file, the locales list is empty and nothing is translated.

Wrap the object in `defineConfig` so your editor knows the options:

```ts [diglot.config.ts]
import { defineConfig } from '@diglot/core'

export default defineConfig({
  locales: ['fr'],
  glossary: 'glossary.yml',
  mt: {
    model: 'anthropic/claude-sonnet-5.5',
    subject: 'the documentation of Nuxt, a Vue web framework',
    batch: 'page',
    qaRetries: 1,
  },
})
```

## Options

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

<tbody>
  <tr>
    <td>
      <code>
        locales
      </code>
    </td>
    
    <td>
      none
    </td>
    
    <td>
      The target locales, as BCP 47 tags such as <code>
        fr
      </code>
      
      , <code>
        ja
      </code>
      
       or <code>
        pt-BR
      </code>
      
      . Any other value is rejected when the config loads.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        sources
      </code>
    </td>
    
    <td>
      <code>
        sources.yml
      </code>
    </td>
    
    <td>
      The path to a sources file, or the list of sources itself. See <a href="https://diglot.sh/guide/how-to/sources">
        sources
      </a>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        parser
      </code>
    </td>
    
    <td>
      <code>
        comark
      </code>
    </td>
    
    <td>
      The markdown parser used for extraction, <code>
        comark
      </code>
      
       or <code>
        mdast
      </code>
      
      . Use <code>
        mdast
      </code>
      
       for sources that aren't written in comark or MDC.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        policy
      </code>
    </td>
    
    <td>
      the default policy
    </td>
    
    <td>
      Overrides for what counts as prose. See <a href="https://diglot.sh/guide/concepts/segments">
        segments
      </a>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        diff
      </code>
    </td>
    
    <td>
      <code>
        threshold: 0.5
      </code>
      
      , <code>
        margin: 0.1
      </code>
    </td>
    
    <td>
      How segments are paired when a source changes. See <a href="https://diglot.sh/guide/concepts/keeping-in-sync">
        keeping in sync
      </a>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        outDir
      </code>
    </td>
    
    <td>
      <code>
        dist
      </code>
    </td>
    
    <td>
      Where <code>
        build
      </code>
      
       writes the locale bundles.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        stateDir
      </code>
    </td>
    
    <td>
      <code>
        .diglot
      </code>
    </td>
    
    <td>
      Where manifests and other generated state live.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        glossary
      </code>
    </td>
    
    <td>
      <code>
        glossary.yml
      </code>
      
      , when the file exists
    </td>
    
    <td>
      A glossary shared by every locale.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        mt
      </code>
    </td>
    
    <td>
      <code>
        {}
      </code>
    </td>
    
    <td>
      Machine translation settings.
    </td>
  </tr>
</tbody>
</table>

The `.navigation.yml` files in your sources are always extracted by the comark parser, whichever `parser` you choose for markdown, so a mixed source keeps its titles translated.

## Machine translation options

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

<tbody>
  <tr>
    <td>
      <code>
        model
      </code>
    </td>
    
    <td>
      <code>
        DIGLOT_MT_MODEL
      </code>
    </td>
    
    <td>
      A model id for the <a href="https://vercel.com/ai-gateway" rel="nofollow">
        Vercel AI Gateway
      </a>
      
      , such as <code>
        anthropic/claude-sonnet-5.5
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        subject
      </code>
    </td>
    
    <td>
      <code>
        technical documentation
      </code>
    </td>
    
    <td>
      What is being translated. It goes into the prompt, so a precise subject such as "the documentation of Nuxt, a Vue web framework" gives better translations.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        batch
      </code>
    </td>
    
    <td>
      <code>
        page
      </code>
    </td>
    
    <td>
      Send each page's segments in one request, or give a number to send that many segments per request.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        qaRetries
      </code>
    </td>
    
    <td>
      <code>
        1
      </code>
    </td>
    
    <td>
      How often to retry a segment that fails an error-level QA check before rejecting it.
    </td>
  </tr>
</tbody>
</table>

The Action's `model` input overrides `mt.model`. See [Machine translation](https://diglot.sh/machine-translation/overview) for how these options are used.


## Sitemap

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