mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(DeepL Node): Add support for longer texts + Credential tests (#3651)
* Updated DeepL to send data with Body instead of QS allowing larger translations * Updated Credentials and added test
This commit is contained in:
committed by
GitHub
parent
088daf952e
commit
88d6cfc07b
@@ -116,18 +116,18 @@ export class DeepL implements INodeType {
|
||||
if (resource === 'language') {
|
||||
|
||||
if (operation === 'translate') {
|
||||
|
||||
let body: IDataObject = {};
|
||||
const text = this.getNodeParameter('text', i) as string;
|
||||
const translateTo = this.getNodeParameter('translateTo', i) as string;
|
||||
const qs = { target_lang: translateTo, text } as IDataObject;
|
||||
body = { target_lang: translateTo, 'text': text } as IDataObject;
|
||||
|
||||
if (additionalFields.sourceLang !== undefined) {
|
||||
qs.source_lang = ['EN-GB', 'EN-US'].includes(additionalFields.sourceLang as string)
|
||||
body.source_lang = ['EN-GB', 'EN-US'].includes(additionalFields.sourceLang as string)
|
||||
? 'EN'
|
||||
: additionalFields.sourceLang;
|
||||
}
|
||||
|
||||
const response = await deepLApiRequest.call(this, 'GET', '/translate', {}, qs);
|
||||
const response = await deepLApiRequest.call(this, 'GET', '/translate', body);
|
||||
responseData.push(response.translations[0]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user