> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tolk.every-day.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Translating with AI

> A first version of your translations with AI, with the glossary, a style instruction and a cost estimate up front.

AI quickly delivers a first version of your translations. Tolk protects placeholders, sends along the glossary and a style instruction, and checks the result. Managers and developers can start AI in all languages, translators in their own languages.

## How to translate with AI

<Steps>
  <Step title="Open the dialog">
    Click **Translate with AI** (*Vertalen met AI*):

    * in the editor of a target language: that language is chosen. If you have selected keys or a filter is active, Tolk suggests translating only those;
    * on the project's **Languages** (*Talen*) tab or in the editor of the source language: you choose the target languages yourself, with **Select all** (*Alles selecteren*). On the Languages tab a progress line per language shows how far the translation is.
  </Step>

  <Step title="Choose languages">
    Choose one or more target languages. A language for which an AI translation is already running shows **Already running** (*Loopt al*).
  </Step>

  <Step title="Choose what to translate">
    * **Only untranslated keys** (*Alleen niet-vertaalde keys*): empty and outdated translations. This is the safe default.
    * **All keys** (*Alle keys*): existing translations are overwritten too. Tolk tells you how many.
  </Step>

  <Step title="Glossary and cost">
    Turn **Use glossary** (*Glossary gebruiken*) on or off. You see the **Estimated cost** (*Geschatte kosten*) in euros and how much is left of this month's budget (from the customer's plan).
  </Step>

  <Step title="Start">
    Click **Translate** (*Vertalen*). You can keep working; the translations appear in the editor by themselves. The progress is shown at the top, where you can also **Stop** (*Stoppen*) the translation.
  </Step>
</Steps>

For a new language you can also have everything translated right away: in **Add language** (*Taal toevoegen*), check **Translate with AI right away** (*Direct vertalen met AI*).

## Keys without a source text

AI translates from the source language, so every key needs a text to start from:

* **The source text** of the key, when the source language has one.
* **The key itself**, when the source language has no text and the key is written as text: a key of a Laravel JSON file (`__('About us')`) or a WordPress `msgid`. Laravel and WordPress show the key when there is no translation, so it is the source text. Once you fill in the source text, AI uses that instead; a translation made from the key only becomes outdated if the source text differs from the key.
* **Nothing**, for a key of a Laravel PHP file (such as `auth.failed` in `lang/en/auth.php`) and for a plural key without a source text: such a key is a name, not a text, so AI skips it.

The dialog tells you how many keys it skips (*… keys zonder brontekst worden overgeslagen*). When nothing is left to translate, it explains why and links to the editor of the source language: fill in the source texts there, or [import](/guide/importing) them.

## Direct or through the Batch API

* **Direct**: smaller jobs are translated immediately. Tolk estimates how long it takes, usually a few minutes.
* **Batch API**: with many keys (from about 2,000), Tolk uses OpenAI's cheaper Batch API. It costs half as much, but the result arrives within 24 hours. The status line then says Tolk is waiting for OpenAI instead of showing a progress bar: a batch returns all translations at once.

## What the AI receives

* The source and target language, including the variant (`de_CH`, for example, does not use ß).
* The **customer's style instruction** (tone of voice, formal or informal address, audience) and the project's **Instruction for AI** (*Instructie voor AI*) (**Settings**, *Instellingen*).
* The glossary terms that occur in the texts, with the do-not-translate list.
* Per key the name, the description, the maximum length and the plural forms of the target language.
* For an outdated translation, the old translation, so the tone stays the same.

Only texts, key names and descriptions are sent to OpenAI, never user data.

## Checks afterwards

Before translating, placeholders are replaced by tokens; afterwards they are put back and checked. If a translation still has an error, Tolk retries once with the error message included. If the error remains, the translation is saved with a placeholder error. The notification afterwards shows how many keys were translated, how many have a placeholder error and how many were skipped because someone changed them in the meantime.

## When AI does not start

If you may start AI but it is not available, the **Translate with AI** button is grayed out. Hover over it or focus it to see why:

| Reason | What to do |
| - | - |
| AI translation is off for this project (*AI-vertaling staat uit voor dit project*) | A manager turns AI on in the project's **Settings** (*Instellingen*) |
| AI translation is off for this customer (*AI-vertaling staat uit voor deze klant*) | A manager of the customer turns it on under [Settings › AI](/guide/customer-settings#ai) |
| AI translation has not been set up in Tolk yet (*AI-vertaling is nog niet ingesteld in Tolk*) | Contact Every Day |
| This month's AI budget is used up (*Het AI-budget van deze maand is op*) | Wait for next month or contact Every Day for a larger [plan](/guide/plan-and-usage) |

Messages you may see after starting:

| Message | Cause |
| - | - |
| Not enough AI budget (*Onvoldoende AI-budget*) | The estimate is higher than what is left this month. Wait for next month or contact Every Day for a larger [plan](/guide/plan-and-usage) |
| Stopped: the AI budget is used up (*Gestopt: het AI-budget is op*) | The budget ran out during the translation. What was already translated stays |
| There is nothing to translate: … keys have no source text yet (*Er is niets te vertalen: … keys hebben nog geen brontekst*) | The keys in the selection have no source text and the key cannot stand in for one. Fill in the source language first or import the source texts |
| Too many AI requests (*Te veel AI-verzoeken*) | You started too often, or the project has used its quota for today. Wait a moment and try again. Stopping a running translation is always possible |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.