Repository navigation
TL;DR: new APIs in this release: the Admin API, spoken terms, style profiles and text correction.
Translation memories, style rules and multilingual glossaries gained many options and fixes.
Read Changed and Deprecated before upgrading; no public API is removed in this release.
Added
- Added
getStatusString()toTranslationMemoryJoband
TranslationMemoryJobResult, returning the job status as the API sent it,
including values not inTranslationMemoryJobResult.Status(for which
getStatus()returnsnull). - Added
CreateTranslationMemoryImportOptions(content type, display name,
extra body parameters) andcreateTranslationMemoryImport()overloads taking
only the file name and size, or an options object; extra body parameters are
added to the request last. - Added
ImportTranslationMemoryOptions(display name, content type, timeout,
extra body parameters) andimportTranslationMemoryFromFilepath()overloads
taking it, with aFileor with the file content asbyte[]plus a file
name. The content type is declared on the import job and sent with the upload. - Added
exportTranslationMemoryToFilepath()overloads that write to an
OutputStream, and one taking aTranslationMemoryInfo, aFileand a
timeout. - Added
getTranslationMemoryJob()andwaitUntilTranslationMemoryJobDone()
overloads that take aTranslationMemoryJobobject. - Added
uploadTranslationMemoryFile(String uploadUrl, byte[] fileContent),
which uploads with the content typeapplication/xml. - Added overloads of
getStyleRule(),updateStyleRuleName(),
deleteStyleRule(),updateStyleRuleConfiguredRules()and the four style
rule custom instruction methods that take aStyleRuleInfoobject, and
overloads ofgetStyleRuleCustomInstruction(),
updateStyleRuleCustomInstruction()anddeleteStyleRuleCustomInstruction()
that take aCustomInstructionobject. - Added
createStyleRule()andupdateStyleRuleConfiguredRules()overloads
that take the configured rules as aMap<String, Map<String, String>>, sent
as given, so categories and rules beyond the fields ofConfiguredRulescan
be sent. - Added
CreateStyleRuleOptions,UpdateStyleRuleNameOptions,
UpdateStyleRuleConfiguredRulesOptions,
CreateStyleRuleCustomInstructionOptionsand
UpdateStyleRuleCustomInstructionOptions, and overloads of the matching style
rule methods that take them; their extra body parameters are added to the
request last. - Added
DeepLClient.updateMultilingualGlossary()and
UpdateMultilingualGlossaryOptions, which rename a glossary and merge
dictionaries into it in one request, sending only the fields that are set. - Added
CreateMultilingualGlossaryOptionsand
ReplaceMultilingualGlossaryDictionaryOptions, and overloads of the
multilingual glossary create, update and replace methods that take an options
object whose extra body parameters are added to the request last. - Added
getMultilingualGlossary(),updateMultilingualGlossaryName(),
updateMultilingualGlossaryDictionaryFromCsv()and
replaceMultilingualGlossaryDictionaryFromCsv()overloads that take a
MultilingualGlossaryInfoobject. - Added
DeepLException.getHttpStatusCode(), the HTTP status code of the
failed response (nullif there was none), and
DeepLException.getShouldRetry(), which istruefor HTTP 429, HTTP 5xx and
connection, DNS and timeout failures. - Added
setProxyUrl(String)toDeepLClientOptions(TranslatorOptions) and
DeepLAdminClientOptions, which takes an HTTP proxy URL such as
http://proxy.example.com:3128. TextTranslationOptions.setExtraBodyParameters()and
DocumentTranslationOptions.setExtraBodyParameters()now return the options
class, so further setters can be chained after them.- Added the
setStyleProfile()option toTextTranslationOptionsand
DocumentTranslationOptions, sent asstyle_profile_idon text and
document translation. It accepts a style profile ID or aStyleProfile
object. - Added the
TagHandlingMode,TagHandlingVersionandModelTypeenums and
TextTranslationOptions.setTagHandling(),setTagHandlingVersion()and
setModelType()overloads that take them; the string setters remain. - Added
TextTranslationOptions.setFormality(String)and
setSentenceSplittingMode(String), which send the string as given, for
values not yet inFormalityorSentenceSplittingMode. - Added
TextTranslationOptions.setSplittingTags(String),
setNonSplittingTags(String)andsetIgnoreTags(String), which send a
comma-separated tag list as given. - Added
TextTranslationOptions.setStyleRule(String)and
setTranslationMemory(String), taking the style rule or translation memory
ID. - Added
TextTranslationOptions.setGlossaryIds(IGlossary, IGlossary...),
taking glossary objects. - Added
Translator.translateDocumentGetStatus(), which returns the status of
a document translation. - Added a
translateDocumentWaitUntilDone(DocumentHandle, Duration)overload
that throws aDeepLExceptionwhen the timeout expires, and
DocumentTranslationOptions.setTimeout(Duration), which limits how long
translateDocument()waits for the translation; on expiry it throws a
DocumentTranslationExceptionwith the document handle. - Added
DocumentTranslationOptions.setFilename(), the file name sent with the
upload in place of the input file's name. - Added
DocumentTranslationOptions.setFormality(String), which sends the
string as given. - Added
DocumentTranslationOptions.setStyleRule(String),
setTranslationMemory(String)and
setGlossaryIds(IGlossary, IGlossary...). - Added
DocumentStatus.getStatusString(), the status as the API sent it,
including values not inDocumentStatus.StatusCode. - Added
TextResult.getTagHandlingVersion(), the tag handling version the API
used (tag_handling_version);nullwhen the response does not contain it. - Added style profile support to
DeepLClient(/v3/style_profiles):
createStyleProfile(),listStyleProfiles(),getStyleProfile(),
updateStyleProfile()anddeleteStyleProfile(), with the new classes
StyleProfile,CreateStyleProfileOptionsandUpdateStyleProfileOptions
(which addssetName()). Both options classes support
setExtraBodyParameters().setGlossaryIds(),setStyleRuleIds()and
setTranslationMemoryIds()take a list of IDs or theIGlossary,
StyleRuleInfoorTranslationMemoryInfoobjects. Options leftnullare
not sent; an empty string clears the description or industry and an empty
list unlinks all components of that kind.StyleProfile.getCreationTime()
andgetUpdatedTime()are nevernull; a response without a valid
creation_timeorupdated_timeraises aDeepLException. - Added Spoken Terms support to
DeepLClient(/v3/spoken-terms):
createSpokenTerms(),listSpokenTerms(),getSpokenTerms(),
updateSpokenTerms(),getSpokenTermsEntries(),replaceSpokenTermsList(),
deleteSpokenTerms()anddeleteSpokenTermsList(), with the new classes
SpokenTerms,SpokenTermsListandSpokenTermsEntries.
updateSpokenTerms()takes anUpdateSpokenTermsOptions(setName(),
setTermLists()) and sends only the fields set;createSpokenTerms()and
replaceSpokenTermsList()take optionalCreateSpokenTermsOptionsand
ReplaceSpokenTermsListOptions. All three options classes support
setExtraBodyParameters(). Collection IDs are URL-encoded in the request
path. Terms are passed and returned as a list of strings; each term is
trimmed of leading and trailing whitespace and then checked like a glossary
term, so a term containing a newline throws anIllegalArgumentException. - Added the
DeepLAdminClientclass for the Admin API. It must be created with
an admin API key and supports managing developer keys
(createDeveloperKey(),listDeveloperKeys(),deactivateDeveloperKey(),
renameDeveloperKey(),setDeveloperKeyUsageLimits()) and retrieving usage
analytics (getUsageAnalytics()with an optionalgroupByargument and
getCustomTagUsageAnalytics()with optionalaggregateByandpage
arguments;groupByandaggregateBytake theAdminUsageGroupByand
CustomTagUsageAggregateByenums or a string, sent as given; the client is
configured withDeepLAdminClientOptions).createDeveloperKey()takes a
CreateDeveloperKeyOptionswith the label; the other key functions have
overloads takingDeactivateDeveloperKeyOptions,
RenameDeveloperKeyOptionsandSetDeveloperKeyUsageLimitsOptions. All
four supportsetExtraBodyParameters(), added to the JSON body last.
Responses
areDeveloperKey,DeveloperKeyUsageLimits,AdminUsageReport,
AdminUsageBreakdown(includinggetSpeechToSpeechMinutes()),KeyUsage,
CustomTagUsageReport,CustomTagUsageandCustomTagUsageBreakdown.
The analytics functions takeLocalDate,"YYYY-MM-DD"strings, orDate
andInstantvalues, of which the UTC day is sent; both the start and the
end day are included. Report dates areDatevalues at midnight UTC.
DeveloperKey.getLabel(),DeveloperKey.getUsageLimits(),
KeyUsage.getApiKeyLabel(),AdminUsageReport.getTotalUsage()and
AdminUsageBreakdown.getSpeechToSpeechMinutes()and
CustomTagUsageBreakdown.getSpeechToSpeechMinutes()(both aDouble) return
nullwhen the API sends no value.
setDeveloperKeyUsageLimits()takes aDeveloperKeyUsageLimitsUpdateand
changes only the limits set in it, including the speech-to-speech limit. - Added the API Pro fields of
GET /v2/usagetoUsage:
getApiKeyCharacter()(per-key character usage),getSpeechToTextMinutes(),
getSpeechToSpeechMinutes(),getStartTime()andgetEndTime()(billing
period) andgetProducts()(per-product usage asUsage.Product). They are
nullwhen the response does not contain them, for example for Free accounts. - Added
DocumentTranslationOptions.setEnableWatermark()to add a
"Translated by DeepL" watermark to translateddocxandpdfdocuments.
By default the option is not sent. - Added
DocumentTranslationOptions.setOutputFormat()to request the file
format of the translated document, for exampledocx. By default the
translated document has the same format as the input document. - Added
LanguageCodeconstants for the target language variantsde-CH,
de-DE,es-ES,es-419,fr-CA,fr-FR,zh-Hansandzh-Hant. They
are deprecated, like the otherLanguageCodeconstants. - Added
DeepLClient.getLanguagesForResource(), which calls
GET /v3/languagesfor a given resource (translate_text,glossary,
write, ...) and returnsLanguageSupportobjects with per-language
feature support. The resource is aLanguageResourceNameor a string;
optionalGetLanguagesForResourceOptions.setInclude()takes
LanguageIncludevalues (Beta,External) or strings, each sent as an
includequery parameter. - Added
DeepLClient.getLanguageResources(), which calls
GET /v3/languages/resourcesand returnsLanguageResourceobjects
describing each resource's features and whether they need source and/or
target language support ([secure]when the API omits the flag). - Added
correctText()to theDeepLClientclass, which corrects grammar, spelling
and punctuation using the/v2/write/correctendpoint. It accepts a single
text or a list of texts, an optional target language and an optional
CorrectTextOptions, which supportssetExtraBodyParameters(). A response
without one complete result per input text raises aDeepLException. - Added
TextRephraseOptions.setWritingStyle(WritingStyle)and
setTone(WritingTone)overloads; the string setters remain. TextRephraseOptionsnow extendsBaseRequestOptionsand supports
setExtraBodyParameters(), added last to therephraseText()request body.
Changed
- Code recompiled against this release that passes a literal
nullto
DeepLClient.importTranslationMemoryFromFilepath(File, ...)as the second
argument, or tosetFormality(),setStyleRule()or
setTranslationMemory()ofTextTranslationOptionsor
DocumentTranslationOptions, tosetTagHandling(),
setTagHandlingVersion(),setSentenceSplittingMode(),setModelType(),
setIgnoreTags(),setSplittingTags()orsetNonSplittingTags()of
TextTranslationOptions, or tosetWritingStyle()orsetTone()of
TextRephraseOptions, fails to compile (reference to ... is ambiguous),
because these methods gained overloads; cast thenullto the parameter
type, e.g.(String) null. Already-compiled code is not affected. - Requests to the pre-signed translation memory storage URLs now send the same
User-Agentas DeepL API requests (the one set withsetHeaders(), if any);
previously they sent the JVM default. They still get noAuthorizationor
other custom headers. translateText()sends the language codes with the language part
lower-cased and the rest as given, like document translation, for example
zh-Hans; before, the part after the first-was upper-cased.- Text translation accepts a glossary (
setGlossary()) or glossary list
(setGlossaryIds()) without a source language; the API detects the source
language and uses the glossary's dictionary for the detected language pair.
Document translation with a glossary still requires a source language. TranslationMemoryJob.getProduct(),getOperation(),getCreationTime()
andgetUpdatedTime()are no longer annotated@Nullable, as the API always
returns these fields.- The bare target languages
enandptare now accepted in text
translation, document translation and rephrasing (the API usesen-USand
pt-PT); previously they were rejected with anIllegalArgumentException. getSourceLanguages(),getTargetLanguages(),getLanguages()and
getGlossaryLanguages()now useGET /v3/languagesinstead of the
deprecated v2 endpoints. The returned lists may contain additional
languages, including the bareenandptas target languages.
setApiVersion()no longer applies to these calls; previously a v1 setting
also changed their path.- Connection resets, broken pipes and a response body cut off mid-read are now
retried up tomaxRetries, andConnectionException.getShouldRetry()
returnstruefor them; previously they failed at once. Developer key
creation still does not retry a cut-off body. - Refused connections, unreachable hosts and failed DNS lookups are now retried
up tomaxRetrieslike timeouts, in all request types includingPATCH;
previously they failed at once. - A failure while reading the response body, for example a read timeout, now
throws aConnectionExceptionand is retried up tomaxRetries; previously
it threw aDeepLExceptionand was not retried. GlossaryEntriesnow stores and sends terms trimmed of leading and trailing
whitespace (Character.isWhitespace()), soget(" foo ")no longer finds an
entry added as" foo "; previously terms were stored as given. Target terms
set throughreplaceAll()orMap.Entry.setValue()are now checked, and an
invalid character is named in hexadecimal (U+001F).- A document status the library does not know yet now counts as in progress:
translateDocumentWaitUntilDone()andtranslateDocument()keep polling and
DocumentStatus.getStatus()returnsnull; previously they stopped with
"Unknown error". Pass a timeout to bound the wait. DeepLClientOptionssetters now returnDeepLClientOptions; previously they
returnedTranslatorOptions, soDeepLClientOptions options = new DeepLClientOptions().setMaxRetries(1)did not compile and an inline setter
chain resolved to the deprecatedDeepLClient(String, TranslatorOptions)
constructor.- HTTP 401 now throws
AuthorizationException, like HTTP 403; previously a
DeepLExceptionwith "Unknown error". - A malformed or empty API response now throws a
DeepLException; previously a
JsonSyntaxException, aNullPointerException, ornull(for example from
getUsage()). - A whitespace-only auth key is now rejected by the
DeepLClientand
Translatorconstructors with anIllegalArgumentException; previously it
was sent and failed at the API. - A transient failure (connection reset, timeout) while reading a downloaded
document (translateDocumentDownload()) or translation memory export
(downloadTranslationMemoryExport()) is now retried up tomaxRetrieswhile
nothing has been written to the output yet; previously it failed at once. PATCHrequests are now sent at mostmaxRetries + 1times; previously each
try could make up to 3 hidden extra attempts on top ofmaxRetries.- Developer key creation (
createDeveloperKey(), added in this release) is
retried after HTTP 429, a failed DNS lookup, a refused connection or a
connect timeout, as the request was not sent in these cases. A timeout or
connection reset after the request was sent is not retried.
Deprecated
createStyleRule(String, String, ConfiguredRules, List)and
updateStyleRuleConfiguredRules(String, ConfiguredRules)are deprecated; use
the overloads that take aMap<String, Map<String, String>>instead.- Deprecated
Translator.getLanguages(LanguageType)and theLanguageType
enum. UsegetSourceLanguages()orgetTargetLanguages()instead. They
will be removed in the next major version. - Deprecated
GlossaryNotFoundException. Catch its superclass
NotFoundExceptioninstead, which is thrown for HTTP 404 on every endpoint.
It will be removed in the next major version. - Deprecated
DeepLClientOptions.setApiVersion()andgetApiVersion(); the
API version will no longer be configurable in the next major version. - Deprecated the language code constants in
LanguageCode(for example
LanguageCode.German). Pass the language code as a string instead, for
example"de", or usegetSourceLanguages()/getTargetLanguages().
The constants will be removed in the next major version. The class itself
and its helper methods are not deprecated. - Deprecated
TextTranslationOptions.setGlossaryId(),setGlossaries(),
setStyleId()andsetTranslationMemoryId(). UsesetGlossary(),
setGlossaryIds(),setStyleRule()andsetTranslationMemory()instead.
They will be removed in the next major version. - Deprecated
Translator.translateDocumentStatus(); use
translateDocumentGetStatus()instead. Deprecated
DocumentTranslationOptions.setGlossaryId(),setGlossaries(),
setStyleId()andsetTranslationMemoryId(); usesetGlossary(),
setGlossaryIds(),setStyleRule()andsetTranslationMemory()instead.
They will be removed in the next major version.
Fixed
rephraseText()andcorrectText()sendtargetLangwith only the
language part lower-cased and the rest as given, as text and document
translation do:zh-Hansis no longer sent aszh-HANS.- An error response of the form
{"error": {"message": "..."}}now puts its
message into the exception message; an error body without any message is
appended as the raw body instead of an emptyerror message:. - A connection failure while reading a downloaded document
(translateDocumentDownload()) or translation memory export
(downloadTranslationMemoryExport()) now throwsConnectionException
instead of a rawIOException;IOExceptionis left for failures writing
the output. - A
User-Agentheader passed withsetHeaders()now replaces the built
User-Agentin any casing, e.g.user-agent. - An
Authorizationheader passed withsetHeaders()now replaces the built
Authorizationheader in any casing, e.g.authorization; previously the
header that was sent depended on map iteration order. - The language query parameters of
getMultilingualGlossaryDictionaryEntries()
anddeleteMultilingualGlossaryDictionary()now encode a space as%20
instead of+. translateDocumentDownload()treats only 2xx responses as success; a 3xx
response is no longer written to the output but throws aDeepLException
with the status code.translateDocumentDownload()maps an error response without body by its
status, for example toQuotaExceededExceptionor
DocumentNotReadyException, instead of a plainDeepLException.exportTranslationMemoryToFilepath()with aFilenow checks the output
path before it creates the export job: an existing file throwsIOException
and a missing directoryFileNotFoundException, the same classes as before.waitUntilTranslationMemoryJobDone()with a timeout, and the import and
export helpers that use it, now cut the last poll wait short at the timeout
instead of overrunning it by up to 5 seconds.- Translation memory and translation memory job IDs are now URL-encoded in
request paths. - The style rule and custom instruction methods now URL-encode the style rule
ID and custom instruction ID in the request path; they were inserted
unescaped before. replaceMultilingualGlossaryDictionary()and
replaceMultilingualGlossaryDictionaryFromCsv()now send a JSON body, the
only content type the endpoint accepts, instead of a form body.getMultilingualGlossaryDictionaryEntries()now throwsNotFoundException
(GlossaryNotFoundException) if the response contains no dictionary and
DeepLExceptionif it is malformed, instead of an
IndexOutOfBoundsExceptionorNullPointerException.createMultilingualGlossary(),createMultilingualGlossaryFromCsv()and
listMultilingualGlossaries()now throwGlossaryNotFoundExceptionon HTTP
404, like the other multilingual glossary methods.- Multilingual glossary IDs are now URL-encoded in request paths.
rephraseText()raises aDeepLExceptionwhen the response does not
contain one complete result per input text. Before, the single-text
overload threw anIndexOutOfBoundsExceptionor returnednull, and the
list overload returned a short list.translateDocumentGetStatus()andtranslateDocumentDownload()now
URL-encode the document ID in the request path.translateDocumentUpload()andtranslateDocument()with an input stream
now post to/v2/documentinstead of/v2/document/.- Document translation now sends the source and target language codes with
only the language part lower-cased, for examplezh-Hans; it sent
zh-HANSbefore. translateText()no longer fails when a translation in the response has no
billed_characters(getBilledCharacters()returns 0) or anull
model_type_used(getModelTypeUsed()returnsnull).- Fixed the doc comments of
LanguageCode.Englishand
LanguageCode.Portuguese, which claimed they may only be used as source
languages. rephraseText()no longer throws aNullPointerExceptionwhen the target
language isnull.getLanguages()no longer sends aPOSTrequest to/v2/languages; it
now sendsGET.translateDocument()with file arguments andtranslateDocumentDownload()
with an output file no longer delete an existing file at the output path
when they refuse to overwrite it and throw anIOException.PATCHrequests (updateMultilingualGlossaryName(),
updateMultilingualGlossaryDictionary()andupdateStyleRuleName()) now use
the JVM proxy settings (http.proxyHost,https.proxyHostand others) like
all other requests. They ignored them before.