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
{{ message }}
Repository navigation
Commit 677244f
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(v3-languages): collapse fetch + generate into one script
- Folds scripts/generate_language_table.py into
scripts/fetch_v3_languages.py. One script now fetches every
/v3/languages response and regenerates the inline RESOURCES block in
the snippet (or skips the snippet via --no-snippet). The dedicated
workflow step is gone; the cron just runs the fetcher.
- Renames snippets/language-table.jsx to
snippets/supported-languages.jsx so the filename matches the only
component it exports. Updates the two MDX imports and the workflow
add-paths to follow.
- Discovers per-resource files from data/v3-languages/*.json instead
of from a hardcoded list, so new resources (and the manual
translation_memory.json) appear in the snippet automatically.
- Adds retry-with-backoff for transient API failures: 429 and 5xx
statuses plus network errors retry up to five times, honouring
Retry-After when the server sets it. Other HTTP errors raise as
before.
- Validates response schemas before writing them: /resources must be
a list of objects with non-empty string `name`; each per-resource
response must be a list of objects with non-empty string `lang` and
`name`. A schema mismatch raises with the exact path so a workflow
failure is actionable.
- Hard-fails (instead of warning + continuing) when the snippet file
or its BEGIN/END GENERATED markers are missing.
- Trims data/v3-languages/README.md down to the data layout; script
flags and behaviour now live in the script's module docstring and
--help output.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Each per-resource file requests `include=beta&include=external` so the vended data is the full superset. Consumers filter on the `status` and per-feature `external` fields when they want a narrower view.
18
-
19
-
## Refreshing
20
-
21
-
Set `DEEPL_AUTH_KEY` in your environment, then run:
12
+
where <resource> is one of the resources returned by `/resources` (`translate_text`, `translate_document`,
13
+
`voice`, `write`, etc.).
22
14
23
-
```sh
24
-
python3 scripts/fetch_v3_languages.py
25
-
```
26
-
27
-
Flags:
15
+
Each per-resource file requests `include=beta&include=external` so the vended data is the full superset. Consumers filter on the `status` and per-feature `external` fields when they want a narrower view.
28
16
29
-
-`--free` — hit `https://api-free.deepl.com` instead of the Pro endpoint.
30
-
-`--base-url <url>` — point at any other host (staging, mock, local server). Also configurable via the `DEEPL_API_BASE_URL` environment variable.
17
+
These files are refreshed hourly by the [`refresh-v3-languages`](../../.github/workflows/refresh-v3-languages.yml) GitHub Action, which runs [`scripts/fetch_v3_languages.py`](../../scripts/fetch_v3_languages.py) and opens a pull request whenever the API responses change. See that script's module docstring or `--help` for flags and behaviour (auth, alternate endpoints, manual local refresh).
31
18
32
-
The script overwrites every file in this directory.
19
+
## `translation_memory.json`
33
20
34
-
A scheduled GitHub Action refreshes these files automatically and opens a pull request when the responses change; manual runs are only needed for local testing.
21
+
Translation Memory is not yet exposed by `/v3/languages`, so `translation_memory.json` is currently maintained by hand in the shape of a `/v3/languages` response. The fetcher skips it; once the API exposes Translation Memory as a resource, the next refresh will overwrite the manual file with the real response and no other code has to change.
The DeepL API supports the following languages. These can also be retrieved programmatically via the [`/v3/languages` endpoint](/api-reference/languages/retrieve-supported-languages-by-resource), which returns language support per resource along with feature availability (e.g. formality, glossary, auto-detection). The legacy [`/v2/languages` endpoint](/api-reference/languages/retrieve-supported-languages) is also available but deprecated.
0 commit comments