You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Learn how to translate between variants of the same language, such as en-US to en-GB"
3
+
description: "Learn how to translate between language variants, like British English and US English, using the DeepL API."
4
4
public: true
5
5
---
6
6
7
-
You can use the DeepL API to translate between variants of the same language (for example, `pt-PT` to `pt-BR` or `en-US` to `en-GB`) using several methods:
7
+
**This guide shows you:**
8
+
- How to translate between language variants (e.g., `en-US` to `en-GB`, `pt-PT` to `pt-BR`)
9
+
- Which method to choose: Write API, style rules, or custom instructions
10
+
- An example workflow for converting American English to British English
8
11
9
-
-**[Write/Rephrase endpoint](/api-reference/improve-text)**: Rephrases text into the target language variant.
12
+
---
13
+
14
+
## Methods for translating between variants
15
+
16
+
You can use the DeepL API to translate between variants of the same language using 3 methods:
17
+
18
+
### 1. DeepL Write API
19
+
20
+
Use the [/write/rephrase](/api-reference/improve-text) endpoint to rephrase text into the target language variant.
-**[Style rules](/api-reference/style-rules)**: Create a custom style rule and apply it using the [style_id](/api-reference/translate/request-translation#body-style-id) parameter.
36
+
```json Example response
37
+
{
38
+
"improvements": [
39
+
{
40
+
"text": "Check out the new autumn colours!",
41
+
"detected_source_language": "en",
42
+
"target_language": "en-GB"
43
+
}
44
+
]
45
+
}
46
+
```
47
+
48
+
<Warning>
49
+
For longer texts, the Write API may rephrase and enhance content beyond simple variant conversion. If you need to maintain the exact structure while only updating locale-specific spelling and grammar, use another method.
50
+
</Warning>
12
51
13
-
<Info>Both glossaries and style rules are unique to each of DeepL's global data centers and are not shared between them. Clients using the api-us.deepl.com endpoint will not be able to access glossaries or style rules created in the UI at this time.</Info>
52
+
### 2. Style rules with custom instructions
14
53
15
-
-**[Custom instructions](/api-reference/translate/request-translation#body-custom-instructions)**: Add instructions like "translate to British English" to your `/translate` request. You can specify up to 10 custom instructions, each with a maximum of 300 characters.
54
+
Create a reusable [style rule](/api-reference/style-rules) with attached `custom_instructions` describing the desired variant translation.
16
55
17
-
## Example: Converting American English to British English
56
+
**When to use this:**
57
+
- You need to maintain the text's content between variants as precisely as possible
58
+
- You need consistent variant transformations across many translation requests
59
+
- You want to reuse the same variant rules without repeating the custom instructions
18
60
19
-
```Example request
61
+
```bash Example cURL request
20
62
curl -X POST 'https://api.deepl.com/v2/translate' \
Glossaries and style rules are unique to each of DeepL's global data centers and are not shared between them.
85
+
86
+
Clients using the `api-us.deepl.com` endpoint will not be able to access glossaries or style rules created in the UI at this time.
87
+
</Info>
88
+
89
+
### 3. Per-request custom instructions
90
+
91
+
Add [custom_instructions](/api-reference/translate/request-translation#body-custom-instructions) describing the desired variant translation directly into your `/translate` requests.
92
+
93
+
**When to use this:**
94
+
- You need to maintain the text's content between variants as precisely as possible
95
+
- You need ad-hoc, one-off translations with specific variant requirements
96
+
- You don't want to manage separate style rules
97
+
98
+
```bash Example cURL request
99
+
curl -X POST 'https://api.deepl.com/v2/translate' \
"text": ["I went to the pharmacy to get some acetaminophen."],
103
+
"text": ["I went to the pharmacy."],
25
104
"target_lang": "en-GB",
26
-
"model_type": "quality_optimized",
27
-
"custom_instructions": ["translate to British English", "only replace words that would be different"]
105
+
"custom_instructions": ["translate to British English"]
28
106
}'
29
107
```
30
108
@@ -33,12 +111,22 @@ curl -X POST 'https://api.deepl.com/v2/translate' \
33
111
"translations": [
34
112
{
35
113
"detected_source_language": "EN",
36
-
"text": "I went to the chemist to get some paracetamol.",
37
-
"model_type_used": "quality_optimized"
114
+
"text": "I went to the chemist's."
38
115
}
39
116
]
40
117
}
41
118
```
42
119
43
-
<Tip>The custom instructions convert American English terms ("pharmacy", "acetaminophen") to British English equivalents ("chemist", "paracetamol") while preserving sentence structure.</Tip>
120
+
You can specify up to 10 custom instructions per request, each with a maximum of 300 characters.
121
+
122
+
---
123
+
124
+
## Next steps
125
+
126
+
Now that you understand how to translate between language variants:
127
+
128
+
-**Try it yourself:** Test out style rules and custom instructions in the [text translation API playground](/api-reference/translate)
129
+
-**Learn about the Write API:** Explore the [/write/rephrase endpoint](/api-reference/improve-text) for high-quality variant translation and rephrasing
130
+
-**Manage reusable rules:** Learn how to create [style rules](/api-reference/style-rules) for systematic variant transformations
131
+
-**Improve translation quality:** Understand how [the context parameter](/docs/best-practices/working-with-context) can enhance ambiguous translations
0 commit comments