---
title: "Nuxt translations"
description: "Walk through a complete translations repository that translates the Nuxt documentation into French."
canonical_url: "https://diglot.sh/guide/examples/nuxt-translations"
---
# Nuxt translations

> Walk through a complete translations repository that translates the Nuxt documentation into French.

`examples/nuxt` in the diglot repository is a starting point for a translations repository: the Nuxt docs (`nuxt/nuxt` on `main`, `4.x` and `3.x`), the `nuxt/cli` docs and the `nuxt/fonts` docs, translated into French. Copy the directory into an empty repository to bootstrap your own.

## What it contains

<table>
<thead>
  <tr>
    <th>
      File
    </th>
    
    <th>
      Purpose
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        diglot.config.ts
      </code>
    </td>
    
    <td>
      Locales and machine translation settings
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        sources.yml
      </code>
    </td>
    
    <td>
      Repositories, refs and directories that feed the corpus
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        glossary.yml
      </code>
    </td>
    
    <td>
      Terminology shared by every locale, in x18n's shape
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        fr/glossary.yml
      </code>
    </td>
    
    <td>
      French terminology that needs diglot-only fields
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        fr/style.yml
      </code>
    </td>
    
    <td>
      French style rules and typography
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        fr/locale.yml
      </code>
    </td>
    
    <td>
      The French machine translation switch
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        .github/workflows/translate.yml
      </code>
    </td>
    
    <td>
      Runs the Action on a source push, on demand and daily
    </td>
  </tr>
</tbody>
</table>

Five sources feed it. The three Nuxt branches and `nuxt/cli` and `nuxt/fonts` each have `dir: docs`, and the three branches share one checkout at `.diglot/checkouts/nuxt/nuxt`. Because identical text shares a hash, a sentence that is the same on `main` and `4.x` is translated once.

## The configuration

The config enables the French locale, uses the shared glossary and sets the model, subject and QA behaviour:

```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,
  },
})
```

## The workflow

The workflow in `.github/workflows/translate.yml` runs on three triggers: a `repository_dispatch` of type `source-push` that source repositories send after a docs push, a manual `workflow_dispatch` with optional `sources` and `limit` inputs, and a daily schedule that catches anything missed. It caches `.diglot/checkouts`, runs the Action with `build-dist: 'false'`, and pushes the Action's commit when `committed` is `true`.

The concurrency group `translate` has `cancel-in-progress: false`, so a second trigger waits for the running job instead of cancelling it.

## Set it up

1. Add an `AI_GATEWAY_API_KEY` secret containing a Vercel AI Gateway key.
2. Run the `translate` workflow once by hand. The first run translates every segment of every source, so pass `limit` to spread it over several runs.
3. In each source repository, send a `repository_dispatch` of type `source-push` after a push that touches the docs, with `client_payload.sources` naming the sources to refresh.

## French style

The French rules in `fr/style.yml` address the reader as `vous`, use the imperative for instructions, write headings in sentence case, keep code identifiers and file names in English, and use guillemets for quoted prose. The `typography` block inserts a narrow no-break space before `;`, `:`, `!`, `?` and `»` and after `«`, so the model doesn't have to.

## Switching machine translation off

Set `mt.enabled` to `false` in `fr/locale.yml`. The Action then writes no new French records, and the existing ones stay in the bundle.

## Next steps

- [Set up the Action](https://diglot.sh/workflow/action/setup) explains the workflow step by step.
- [Glossary and style](https://diglot.sh/guide/how-to/glossary-and-style) shows how the glossary files work.


## Sitemap

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