Skip to content

Commit 7ebbf87

Browse files
lilkraftwerkLucas Mathis
andauthored
Generate the language docs from /v3/languages (#395)
Replace the hand-maintained language lists with generators that render them from the live GET /v3/languages response: the supported-languages table (snippets/language-table.jsx), the Voice support matrix and input/target lists, and the style-rules callout on the supported-languages page. Generated content sits between BEGIN/END GENERATED markers; everything outside them stays hand-written. node scripts/update-language-docs.mjs <api-key> runs every generator; each script also runs standalone and supports --dry-run. Shared plumbing lives in scripts/lib.mjs with zero-dependency unit tests (node --test, wired up in CI via test-scripts.yml). A daily workflow (sync-language-docs.yml) regenerates the docs and opens or updates a bot PR whenever the API response changed, surfacing any generator warnings in the PR body. The regenerated content also refreshes the data itself: new Voice languages (Hindi, Malay, Tamil), the style-rules expansion from 8 to 33 target languages, and the full translate_text long tail in the language table. Co-authored-by: Lucas Mathis <lucas.mathis@deepl.com>
1 parent 36d4cf1 commit 7ebbf87

13 files changed

Lines changed: 776 additions & 178 deletions
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Sync language docs
2+
3+
on:
4+
schedule:
5+
- cron: "17 6 * * *"
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
concurrency:
13+
group: sync-language-docs
14+
cancel-in-progress: false
15+
16+
jobs:
17+
sync:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v5
21+
- uses: actions/setup-node@v5
22+
with:
23+
node-version: 22
24+
- name: Regenerate language docs from /v3/languages
25+
env:
26+
DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }}
27+
# stderr goes to a file first (a `>(tee ...)` child is not awaited, the
28+
# next step could read a partial file), then back into the step log
29+
run: |
30+
node scripts/update-language-docs.mjs "$DEEPL_API_KEY" 2> "$RUNNER_TEMP/warnings.txt" || { cat "$RUNNER_TEMP/warnings.txt" >&2; exit 1; }
31+
cat "$RUNNER_TEMP/warnings.txt" >&2
32+
- name: Open or update the sync PR
33+
env:
34+
GH_TOKEN: ${{ github.token }}
35+
WARNINGS_FILE: ${{ runner.temp }}/warnings.txt
36+
run: scripts/open-sync-pr.sh

‎.github/workflows/test-scripts.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test scripts
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "scripts/**"
7+
push:
8+
branches:
9+
- main
10+
paths:
11+
- "scripts/**"
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v5
18+
- uses: actions/setup-node@v5
19+
with:
20+
node-version: 22
21+
- run: node --test scripts/*.test.mjs

‎api-reference/voice/deepl-voice-api-service-specification-updates.mdx‎

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,22 @@ audio provides the following functionality:
3333
<td>
3434
<p>The realtime audio stream you want to have translated can be in one of the following languages:</p>
3535
<ul>
36+
{/* BEGIN GENERATED voice-input-languages (run: node scripts/update-language-docs.mjs) */}
3637
<li>`ar` (Arabic)</li>
3738
<li>`bg` (Bulgarian)</li>
3839
<li>`bn` (Bengali)</li>
3940
<li>`cs` (Czech)</li>
4041
<li>`da` (Danish)</li>
4142
<li>`de` (German)</li>
4243
<li>`el` (Greek)</li>
43-
<li>`en` (British)</li>
44+
<li>`en` (English)</li>
4445
<li>`es` (Spanish)</li>
4546
<li>`et` (Estonian)</li>
4647
<li>`fi` (Finnish)</li>
4748
<li>`fr` (French)</li>
4849
<li>`ga` (Irish)</li>
4950
<li>`he` (Hebrew)</li>
51+
<li>`hi` (Hindi)</li>
5052
<li>`hr` (Croatian)</li>
5153
<li>`hu` (Hungarian)</li>
5254
<li>`id` (Indonesian)</li>
@@ -55,8 +57,9 @@ audio provides the following functionality:
5557
<li>`ko` (Korean)</li>
5658
<li>`lt` (Lithuanian)</li>
5759
<li>`lv` (Latvian)</li>
60+
<li>`ms` (Malay)</li>
5861
<li>`mt` (Maltese)</li>
59-
<li>`nb` (Norwegian Bokmål)</li>
62+
<li>`nb` (Norwegian (bokmål))</li>
6063
<li>`nl` (Dutch)</li>
6164
<li>`pl` (Polish)</li>
6265
<li>`pt` (Portuguese)</li>
@@ -65,12 +68,14 @@ audio provides the following functionality:
6568
<li>`sk` (Slovak)</li>
6669
<li>`sl` (Slovenian)</li>
6770
<li>`sv` (Swedish)</li>
71+
<li>`ta` (Tamil)</li>
6872
<li>`th` (Thai)</li>
6973
<li>`tl` (Tagalog)</li>
7074
<li>`tr` (Turkish)</li>
7175
<li>`uk` (Ukrainian)</li>
7276
<li>`vi` (Vietnamese)</li>
7377
<li>`zh` (Chinese)</li>
78+
{/* END GENERATED voice-input-languages */}
7479
</ul>
7580
</td>
7681
</tr>
@@ -79,21 +84,24 @@ audio provides the following functionality:
7984
<td>
8085
<p>The language in which your translations are provided as text can be one of the following:</p>
8186
<ul>
87+
{/* BEGIN GENERATED voice-target-languages (run: node scripts/update-language-docs.mjs) */}
8288
<li>`ar` (Arabic)</li>
8389
<li>`bg` (Bulgarian)</li>
8490
<li>`bn` (Bengali)</li>
8591
<li>`cs` (Czech)</li>
8692
<li>`da` (Danish)</li>
8793
<li>`de` (German)</li>
8894
<li>`el` (Greek)</li>
89-
<li>`en-GB` (British English)</li>
90-
<li>`en-US` (American-English)</li>
95+
<li>`en` (English)</li>
96+
<li>`en-GB` (English (British))</li>
97+
<li>`en-US` (English (American))</li>
9198
<li>`es` (Spanish)</li>
9299
<li>`et` (Estonian)</li>
93100
<li>`fi` (Finnish)</li>
94101
<li>`fr` (French)</li>
95102
<li>`ga` (Irish)</li>
96103
<li>`he` (Hebrew)</li>
104+
<li>`hi` (Hindi)</li>
97105
<li>`hr` (Croatian)</li>
98106
<li>`hu` (Hungarian)</li>
99107
<li>`id` (Indonesian)</li>
@@ -102,26 +110,31 @@ audio provides the following functionality:
102110
<li>`ko` (Korean)</li>
103111
<li>`lt` (Lithuanian)</li>
104112
<li>`lv` (Latvian)</li>
113+
<li>`ms` (Malay)</li>
105114
<li>`mt` (Maltese)</li>
106-
<li>`nb` (Norwegian Bokmål)</li>
115+
<li>`nb` (Norwegian (bokmål))</li>
107116
<li>`nl` (Dutch)</li>
108117
<li>`pl` (Polish)</li>
109-
<li>`pt-BR` (Brazilian Portuguese)</li>
110-
<li>`pt-PT` (Portuguese) (all Portuguese varieties excluding Brazilian Portuguese)</li>
111-
<li>`pt` (Portuguese) (unspecified variant for backward compatibility; please select `pt-PT` or `pt-BR`</li>
118+
<li>`pt` (Portuguese)</li>
119+
<li>`pt-BR` (Portuguese (Brazilian))</li>
120+
<li>`pt-PT` (Portuguese (European))</li>
112121
<li>`ro` (Romanian)</li>
113122
<li>`ru` (Russian)</li>
114123
<li>`sk` (Slovak)</li>
115124
<li>`sl` (Slovenian)</li>
116125
<li>`sv` (Swedish)</li>
126+
<li>`ta` (Tamil)</li>
117127
<li>`th` (Thai)</li>
118128
<li>`tl` (Tagalog)</li>
119129
<li>`tr` (Turkish)</li>
120130
<li>`uk` (Ukrainian)</li>
121131
<li>`vi` (Vietnamese)</li>
132+
<li>`zh` (Chinese)</li>
122133
<li>`zh-Hans` (Chinese (simplified))</li>
123134
<li>`zh-Hant` (Chinese (traditional))</li>
135+
{/* END GENERATED voice-target-languages */}
124136
</ul>
137+
<p>`pt-PT` covers all Portuguese varieties excluding Brazilian Portuguese. `pt` is an unspecified variant kept for backward compatibility; prefer `pt-PT` or `pt-BR`.</p>
125138
</td>
126139
</tr>
127140
</tbody>

‎docs/getting-started/supported-languages.mdx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,9 @@ import { LanguageTable } from "/snippets/language-table.jsx"
2121
*/}
2222

2323
<Info>
24-
Style rules are supported for the following target languages: `de`, `en`, `es`, `fr`, `it`, `ja`, `ko`, and `zh`. For more details, see the [Style Rules API documentation](/docs/customize/using-style-rules). Writing style and tone availability for `/write/rephrase` can also be retrieved via [`GET /v3/languages?resource=write`](/docs/languages/using-the-languages-api).
24+
{/* BEGIN GENERATED style-rules-languages (run: node scripts/update-language-docs.mjs) */}
25+
Style rules are supported for the following target languages: `ar`, `bg`, `cs`, `da`, `de`, `el`, `en`, `es`, `et`, `fi`, `fr`, `he`, `hu`, `id`, `it`, `ja`, `ko`, `lt`, `lv`, `nb`, `nl`, `pl`, `pt`, `ro`, `ru`, `sk`, `sl`, `sv`, `th`, `tr`, `uk`, `vi`, and `zh`.
26+
{/* END GENERATED style-rules-languages */}
27+
28+
For more details, see the [Style Rules API documentation](/docs/customize/using-style-rules). Writing style and tone availability for `/write/rephrase` can also be retrieved via [`GET /v3/languages?resource=write`](/docs/languages/using-the-languages-api).
2529
</Info>

‎docs/voice/supported-languages-formats-and-limits.mdx‎

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,51 @@ description: "Reference for DeepL Voice API language availability, supported aud
88
Translation is always provided by DeepL. For some languages, transcription and translated speech are provided by external service partners. All source languages can be translated into any target language.
99

1010
<Card>
11-
| **Language** | **Transcription** | **Translation** | <Badge color="green">closed beta</Badge><br/>Translated Speech |
12-
| :------------------------------------- | :---------------: | :-------------: | :------------------------------------------------------------: |
13-
| Arabic | ⎋ | ✓ | ⎋ |
14-
| Bengali | ⎋ | ✓ | — |
15-
| Bulgarian | ⎋ | ✓ | ⎋ |
16-
| Chinese (Simplified/Traditional) | ✓ | ✓ | ✓ |
17-
| Croatian | ⎋ | ✓ | — |
18-
| Czech | ✓ | ✓ | ⎋ |
19-
| Danish | ⎋ | ✓ | ⎋ |
20-
| Dutch | ✓ | ✓ | ✓ |
21-
| English (American/British) | ✓ | ✓ | ✓ |
22-
| Estonian | ⎋ | ✓ | — |
23-
| Finnish | ⎋ | ✓ | ⎋ |
24-
| French | ✓ | ✓ | ✓ |
25-
| German | ✓ | ✓ | ✓ |
26-
| Greek | ⎋ | ✓ | ⎋ |
27-
| Hebrew | ⎋ | ✓ | — |
28-
| Hindi <Badge color="blue">beta</Badge> | ⎋ | ✓ | ⎋ |
29-
| Hungarian | ⎋ | ✓ | ⎋ |
30-
| Indonesian | ✓ | ✓ | ⎋ |
31-
| Irish | ⎋ | ✓ | — |
32-
| Italian | ✓ | ✓ | ✓ |
33-
| Japanese | ✓ | ✓ | ✓ |
34-
| Korean | ✓ | ✓ | ✓ |
35-
| Latvian | ⎋ | ✓ | — |
36-
| Lithuanian | ⎋ | ✓ | — |
37-
| Malay <Badge color="blue">beta</Badge> | ⎋ | ✓ | ⎋ |
38-
| Maltese | ⎋ | ✓ | — |
39-
| Norwegian Bokmål | ⎋ | ✓ | ⎋ |
40-
| Polish | ✓ | ✓ | ✓ |
41-
| Portuguese (Brazil/Portugal) | ✓ | ✓ | ✓ |
42-
| Romanian | ✓ | ✓ | ⎋ |
43-
| Russian | ✓ | ✓ | ✓ |
44-
| Slovak | ⎋ | ✓ | ⎋ |
45-
| Slovenian | ⎋ | ✓ | — |
46-
| Spanish | ✓ | ✓ | ✓ |
47-
| Swedish | ✓ | ✓ | ✓ |
48-
| Thai | ⎋ | ✓ | — |
49-
| Tagalog | ⎋ | ✓ | — |
50-
| Tamil <Badge color="blue">beta</Badge> | ⎋ | ✓ | ⎋ |
51-
| Turkish | ✓ | ✓ | ✓ |
52-
| Ukrainian | ✓ | ✓ | ⎋ |
53-
| Vietnamese | ⎋ | ✓ | ⎋ |
11+
{/* BEGIN GENERATED voice-language-matrix (run: node scripts/update-language-docs.mjs) */}
12+
| **Language** | **Transcription** | **Translation** | <Badge color="green">closed beta</Badge><br/>Translated Speech |
13+
| :--- | :---: | :---: | :---: |
14+
| Arabic | ⎋ | ✓ | ⎋ |
15+
| Bengali | ⎋ | ✓ | — |
16+
| Bulgarian | ⎋ | ✓ | ⎋ |
17+
| Chinese (Simplified/Traditional) | ✓ | ✓ | ✓ |
18+
| Croatian | ⎋ | ✓ | — |
19+
| Czech | ✓ | ✓ | ⎋ |
20+
| Danish | ⎋ | ✓ | ⎋ |
21+
| Dutch | ✓ | ✓ | ✓ |
22+
| English (American/British) | ✓ | ✓ | ✓ |
23+
| Estonian | ⎋ | ✓ | — |
24+
| Finnish | ⎋ | ✓ | ⎋ |
25+
| French | ✓ | ✓ | ✓ |
26+
| German | ✓ | ✓ | ✓ |
27+
| Greek | ⎋ | ✓ | ⎋ |
28+
| Hebrew | ⎋ | ✓ | — |
29+
| Hindi <Badge color="blue">beta</Badge> | ⎋ | ✓ | ⎋ |
30+
| Hungarian | ⎋ | ✓ | ⎋ |
31+
| Indonesian | ✓ | ✓ | ⎋ |
32+
| Irish | ⎋ | ✓ | — |
33+
| Italian | ✓ | ✓ | ✓ |
34+
| Japanese | ✓ | ✓ | ✓ |
35+
| Korean | ✓ | ✓ | ✓ |
36+
| Latvian | ⎋ | ✓ | — |
37+
| Lithuanian | ⎋ | ✓ | — |
38+
| Malay <Badge color="blue">beta</Badge> | ⎋ | ✓ | ⎋ |
39+
| Maltese | ⎋ | ✓ | — |
40+
| Norwegian (bokmål) | ⎋ | ✓ | ⎋ |
41+
| Polish | ✓ | ✓ | ✓ |
42+
| Portuguese (Brazil/Portugal) | ✓ | ✓ | ✓ |
43+
| Romanian | ✓ | ✓ | ⎋ |
44+
| Russian | ✓ | ✓ | ✓ |
45+
| Slovak | ⎋ | ✓ | ⎋ |
46+
| Slovenian | ⎋ | ✓ | — |
47+
| Spanish | ✓ | ✓ | ✓ |
48+
| Swedish | ✓ | ✓ | ✓ |
49+
| Tagalog | ⎋ | ✓ | — |
50+
| Tamil <Badge color="blue">beta</Badge> | ⎋ | ✓ | ⎋ |
51+
| Thai | ⎋ | ✓ | — |
52+
| Turkish | ✓ | ✓ | ✓ |
53+
| Ukrainian | ✓ | ✓ | ⎋ |
54+
| Vietnamese | ⎋ | ✓ | ⎋ |
55+
{/* END GENERATED voice-language-matrix */}
5456

5557
✓ provided by DeepL / ⎋ provided by an external service partner / — not available
5658
</Card>

0 commit comments

Comments
 (0)