# Prompt Variables

Variables are placeholders in your prompt text that are automatically filled in at runtime. Use them to make prompts context-aware without rewriting them for every project or language pair.

#### Language variables – all contexts

These work in Batch Translate, Batch Proofread, and QuickLauncher prompts:

| Variable              | Replaced with                                      | Example                   |
| --------------------- | -------------------------------------------------- | ------------------------- |
| `{{SOURCE_LANGUAGE}}` | Full name of the source language, including locale | `Dutch (Belgium)`         |
| `{{TARGET_LANGUAGE}}` | Full name of the target language, including locale | `English (United States)` |

#### Segment variables – QuickLauncher only

These are only available in QuickLauncher prompts, because they refer to the specific segment active at the moment you trigger the menu:

| Variable             | Replaced with                                                                                  | Example                                                     |
| -------------------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| `{{SOURCE_SEGMENT}}` | Full source text of the **active segment**                                                     | `De uitvinding heeft betrekking op een nieuwe werkwijze...` |
| `{{TARGET_SEGMENT}}` | Full target text of the **active segment** (your translation so far – may be empty or partial) | `The invention relates to a novel method...`                |
| `{{SELECTION}}`      | Text currently **selected** in the editor (source side preferred; falls back to target side)   | `werkwijze`                                                 |

:::note **Segment vs selection:** `{{SOURCE_SEGMENT}}` and `{{TARGET_SEGMENT}}` always give you the **entire active segment**. `{{SELECTION}}` gives you only the **highlighted portion** – useful for looking up or explaining a specific word or phrase within the segment. If nothing is selected, `{{SELECTION}}` is replaced with an empty string. :::

#### Project variables – QuickLauncher only

| Variable                   | Replaced with                                                                                                                                                                                                    |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `{{PROJECT_NAME}}`         | Trados project name (e.g. `Patent_NL_EN_2026`)                                                                                                                                                                   |
| `{{DOCUMENT_NAME}}`        | Active file name (e.g. `source_document.docx`)                                                                                                                                                                   |
| `{{SURROUNDING_SEGMENTS}}` | N source segments before and after the active segment, with actual Trados segment numbers and the active segment marked `← ACTIVE`. N is set in **Settings → AI Settings → Surrounding segments** (default: 5).  |
| `{{PROJECT}}`              | All source segments in the document, numbered with their actual Trados segment numbers. In multi-file projects a `=== File N ===` header separates each file (Trados restarts segment numbering per file).       |
| `{{TM_MATCHES}}`           | Translation memory fuzzy matches (≥70%) for the active segment, showing match percentage, TM name, source text, and target text. If no matches meet the threshold, replaced with "(no fuzzy matches above 70%)". |

:::caution `{{PROJECT}}` sends the entire document to the AI and uses significantly more tokens than other variables. For a 10,000-word document, this costs roughly 4–5 cents per call with a Sonnet-class model. Reserve it for prompts where full document context genuinely matters.

To keep the chat history readable, the chat bubble shows a compact summary (e.g. `[source document – 47 segments]`) instead of the full source text. The complete document is still sent to the AI. :::

#### Scope: which prompts see which variables

The variables above are **only substituted in QuickLauncher prompts**. In Batch Translate and Batch Proofread custom prompts, only the two **language variables** (`{{SOURCE_LANGUAGE}}` and `{{TARGET_LANGUAGE}}`) get filled in – any other variable left in the prompt body will be replaced with an empty string.

This isn't a limitation in practice. The batch flows assemble a richer system prompt automatically, with no variables required:

* **Batch Translate** automatically includes source-only document context (when **Include document context** is on in [AI Settings](/help/settings/ai-settings.md)), termbase entries, and language-specific checks.
* **Batch Proofread** automatically includes the **full bilingual document context** (source + target, untruncated), termbase entries, and language-specific checks.

So the right place for your custom prompt content in batch mode is to **complement** what's already there – domain-specific guidance, citation discipline, project-specific terminology preferences – rather than try to re-inject document context with `{{PROJECT}}`.

If you want to see exactly what gets sent to the AI for a batch run – fully assembled, including the auto-injected context – click the **👁 Preview prompt** link next to the Translate / Proofread button on the Batch Operations tab. See [Batch Operations](/help/features/batch-operations.md) for details.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://supervertaler.gitbook.io/help/settings/prompts/prompt-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
