-
Notifications
You must be signed in to change notification settings - Fork 3
v3/languages beta #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
daniel-jones-dev
wants to merge
24
commits into
main
Choose a base branch
from
v3-languages-beta
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
v3/languages beta #239
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
b85bd3e
Documentation edits made through Mintlify web editor
mintlify[bot] b245a45
updates to v3/languages endpoints
daniel-jones-dev af0c7bb
move v2 pages to legacy area
daniel-jones-dev 3f43396
consistent feature name "glossary_id"
daniel-jones-dev f9877b4
simple examples
daniel-jones-dev c60b15f
revert naming v2 languages legacy
daniel-jones-dev 9719d74
rewrites and improvements
daniel-jones-dev 7c3ff28
rewrites and improvements
daniel-jones-dev d5f1175
rewrites and improvements
daniel-jones-dev 3c88b7a
rewrites and improvements
daniel-jones-dev 789ac76
page title
daniel-jones-dev f2b6cee
whitespace
daniel-jones-dev 53a433d
add summary of example
daniel-jones-dev 9734348
add exceptions endpoint, better wording
daniel-jones-dev b8bfd8b
openapi for exceptions endpoint
daniel-jones-dev 7e2879b
rewording
daniel-jones-dev 3e1ca97
rewording
daniel-jones-dev 3e2fdad
remove old "glossary" feature
daniel-jones-dev f71f465
change "code" to "lang" for consistency
daniel-jones-dev b0c1cbc
rename glossary_id to glossary
daniel-jones-dev 932342a
clarify language code casing
daniel-jones-dev 250b870
add products endpoint
daniel-jones-dev 5cba33f
make product query parameter required
daniel-jones-dev f7e34bc
add docs about products endpoint
daniel-jones-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
api-reference/api-reference/retrieve-languages/migrate-from-v2-languages.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| --- | ||
| title: 'Migrating from v2/languages' | ||
| description: "How to migrate from the v2/languages endpoint to the v3/languages endpoints." | ||
| --- | ||
|
|
||
| This page covers the differences between the `/v2/languages` endpoint and the v3 endpoints, and how to update your integration. | ||
|
|
||
| <Warning> | ||
| Only `GET` requests are supported on the v3 endpoints. Unlike `/v2/languages`, POST is not supported. | ||
| </Warning> | ||
|
|
||
| ## What changed | ||
|
|
||
| ### Separate endpoints for source and target | ||
|
|
||
| v2 uses a single endpoint with a `type` query parameter: | ||
|
|
||
| ``` | ||
| GET /v2/languages?type=source | ||
| GET /v2/languages?type=target | ||
| ``` | ||
|
|
||
| v3 uses two dedicated endpoints: | ||
|
|
||
| ``` | ||
| GET /v3/languages/source | ||
| GET /v3/languages/target | ||
| ``` | ||
|
|
||
| ### New product identifiers | ||
|
|
||
| v2 languages are implicitly tied to text and document translation. v3 introduces an explicit `product` parameter that applies across all DeepL API products: | ||
|
|
||
| | v2 | v3 `product` value | | ||
| |---|---| | ||
| | *(implicit — text/document translation only)* | `translate_text` | | ||
| | *(implicit — text/document translation only)* | `translate_document` | | ||
| | *(not supported — separate `/v2/glossary-language-pairs` endpoint)* | `glossary` | | ||
| | *(not supported)* | `voice` | | ||
| | *(not supported)* | `write` | | ||
|
|
||
| The v3 endpoints replace both `/v2/languages` and `/v2/glossary-language-pairs`. | ||
|
|
||
| ### Features instead of `supports_formality` | ||
|
|
||
| v2 target languages include a boolean `supports_formality` field. v3 replaces this with a `features` array that covers additional capabilities per product: | ||
|
|
||
| | v2 field | v3 equivalent | | ||
| |---|---| | ||
| | `"supports_formality": true` | `"features": ["formality"]` on both source and target language (when `product` is specified) | | ||
|
|
||
| For example, querying target languages for text translation: | ||
|
|
||
| ```sh | ||
| curl -X GET 'https://api.deepl.com/v3/languages/target?product=translate_text' \ | ||
| --header 'Authorization: DeepL-Auth-Key [yourAuthKey]' | ||
| ``` | ||
|
|
||
| ```json Example response (truncated) | ||
| [ | ||
| { | ||
| "lang": "de", | ||
| "name": "German", | ||
| "features": ["formality", "tag_handling", "glossary"] | ||
| }, | ||
| { | ||
| "lang": "en-US", | ||
| "name": "English (American)", | ||
| "features": ["tag_handling", "glossary"] | ||
| } | ||
| ] | ||
| ``` | ||
|
|
||
| The response indicates German supports `formality`, but English (American) does not. | ||
|
|
||
| The `features` array only appears on a language object when a `product` parameter is specified. See the [overview](/api-reference/api-reference/retrieve-languages/retrieve-supported-languages-by-product-beta) for the full list of features per product. | ||
|
|
||
| ### Flat array response | ||
|
|
||
| v2 returns a flat JSON array. v3 also returns a flat array — but each endpoint returns only its own list (sources or targets), so there is no wrapper object. | ||
|
|
||
| ### Response field names | ||
|
|
||
| | v2 field | v3 field | | ||
| |---|---| | ||
| | `language` | `lang` | | ||
| | `name` | `name` *(unchanged)* | | ||
| | `supports_formality` | `features` *(array, product-specific)* | | ||
|
|
||
| ### Language code casing | ||
|
|
||
| v2 returned language codes in non-standard casing (e.g. `EN-US`, `ZH-HANT`). v3 returns codes compliant with BCP 47: lowercase base language (`en`, `de`), uppercase region subtag (`en-US`, `pt-BR`), and title-case script subtag (`zh-Hant`). | ||
|
|
||
| DeepL accepts language codes case-insensitively as input across all endpoints. However, if your integration stores or compares codes returned by `/v2/languages`, update those comparisons to be case-insensitive or to expect the new casing. | ||
|
|
||
| ## Migrating glossary language pair queries | ||
|
|
||
| If you currently use `/v2/glossary-language-pairs` to discover which language pairs are supported for glossaries, use `/v3/languages/source` and `/v3/languages/target` with `product=glossary` instead. |
4 changes: 4 additions & 0 deletions
4
...nce/api-reference/retrieve-languages/retrieve-language-pair-exceptions-beta.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| openapi: get /v3/languages/exceptions | ||
| title: "Retrieve language pair exceptions [BETA]" | ||
| --- | ||
4 changes: 4 additions & 0 deletions
4
api-reference/api-reference/retrieve-languages/retrieve-products-beta.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| openapi: get /v3/languages/products | ||
| title: "Retrieve language products [BETA]" | ||
| --- |
4 changes: 4 additions & 0 deletions
4
api-reference/api-reference/retrieve-languages/retrieve-source-languages-beta.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| openapi: get /v3/languages/source | ||
| title: "Retrieve source languages [BETA]" | ||
| --- |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want these beta's in the URLs? Unless you want to hide the URLs for the time being, you'll eventually need to redirect these to the ultimate URLs... but I also don't know your entire scheme here.