first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,19 @@
{
"node": "n8n-nodes-base.deepL",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Utility"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/deepl/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.deepl/"
}
]
},
"alias": ["Translate", "Translator"]
}
@@ -0,0 +1,156 @@
import type {
IExecuteFunctions,
IDataObject,
ILoadOptionsFunctions,
INodeExecutionData,
INodePropertyOptions,
INodeType,
INodeTypeDescription,
} from 'n8n-workflow';
import { NodeConnectionTypes } from 'n8n-workflow';
import { deepLApiRequest } from './GenericFunctions';
import { textOperations } from './TextDescription';
export class DeepL implements INodeType {
description: INodeTypeDescription = {
displayName: 'DeepL',
name: 'deepL',
icon: { light: 'file:deepl.svg', dark: 'file:deepL.dark.svg' },
group: ['input', 'output'],
version: 1,
description: 'Translate data using DeepL',
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
defaults: {
name: 'DeepL',
},
usableAsTool: true,
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
credentials: [
{
name: 'deepLApi',
required: true,
},
],
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Language',
value: 'language',
},
],
default: 'language',
},
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['language'],
},
},
options: [
{
name: 'Translate',
value: 'translate',
description: 'Translate data',
action: 'Translate a language',
},
],
default: 'translate',
},
...textOperations,
],
};
methods = {
loadOptions: {
async getLanguages(this: ILoadOptionsFunctions) {
const returnData: INodePropertyOptions[] = [];
const languages = await deepLApiRequest.call(
this,
'GET',
'/languages',
{},
{ type: 'target' },
);
for (const language of languages) {
returnData.push({
name: language.name,
value: language.language,
});
}
returnData.sort((a, b) => {
if (a.name < b.name) {
return -1;
}
if (a.name > b.name) {
return 1;
}
return 0;
});
return returnData;
},
},
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const length = items.length;
const responseData: INodeExecutionData[] = [];
for (let i = 0; i < length; i++) {
try {
const resource = this.getNodeParameter('resource', i);
const operation = this.getNodeParameter('operation', i);
const additionalFields = this.getNodeParameter('additionalFields', i);
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;
body = { target_lang: translateTo, text } as IDataObject;
if (additionalFields.sourceLang !== undefined) {
body.source_lang = ['EN-GB', 'EN-US'].includes(additionalFields.sourceLang as string)
? 'EN'
: additionalFields.sourceLang;
}
const { translations } = await deepLApiRequest.call(this, 'GET', '/translate', body);
const [translation] = translations;
const translationJsonArray = this.helpers.returnJsonArray(translation as IDataObject[]);
const executionData = this.helpers.constructExecutionMetaData(translationJsonArray, {
itemData: { item: i },
});
responseData.push(...executionData);
}
}
} catch (error) {
if (this.continueOnFail()) {
const executionErrorData = {
json: {} as IDataObject,
error: error.message,
itemIndex: i,
};
responseData.push(executionErrorData as INodeExecutionData);
continue;
}
throw error;
}
}
return [responseData];
}
}
@@ -0,0 +1,49 @@
import type {
IExecuteFunctions,
ILoadOptionsFunctions,
IDataObject,
JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
export async function deepLApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions,
method: IHttpRequestMethods,
resource: string,
body: IDataObject = {},
qs: IDataObject = {},
uri?: string,
headers: IDataObject = {},
) {
const proApiEndpoint = 'https://api.deepl.com/v2';
const freeApiEndpoint = 'https://api-free.deepl.com/v2';
const credentials = await this.getCredentials('deepLApi');
const options: IRequestOptions = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
method,
form: body,
qs,
uri: uri || `${credentials.apiPlan === 'pro' ? proApiEndpoint : freeApiEndpoint}${resource}`,
json: true,
};
try {
if (Object.keys(headers).length !== 0) {
options.headers = Object.assign({}, options.headers, headers);
}
if (Object.keys(body).length === 0) {
delete options.body;
}
return await this.helpers.requestWithAuthentication.call(this, 'deepLApi', options);
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
@@ -0,0 +1,121 @@
import type { INodeProperties } from 'n8n-workflow';
export const textOperations: INodeProperties[] = [
{
displayName: 'Text',
name: 'text',
type: 'string',
default: '',
description: 'Input text to translate',
required: true,
displayOptions: {
show: {
operation: ['translate'],
},
},
},
{
displayName: 'Target Language Name or ID',
name: 'translateTo',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLanguages',
},
default: '',
description:
'Language to translate to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
required: true,
displayOptions: {
show: {
operation: ['translate'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
options: [
{
displayName: 'Source Language Name or ID',
name: 'sourceLang',
type: 'options',
default: '',
description:
'Language to translate from. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
typeOptions: {
loadOptionsMethod: 'getLanguages',
},
},
{
displayName: 'Split Sentences',
name: 'splitSentences',
type: 'options',
default: '1',
description: 'How the translation engine should split sentences',
options: [
{
name: 'Interpunction Only',
value: 'nonewlines',
description: 'Split text on interpunction only, ignoring newlines',
},
{
name: 'No Splitting',
value: '0',
description: 'Treat all text as a single sentence',
},
{
name: 'On Punctuation and Newlines',
value: '1',
description: 'Split text on interpunction and newlines',
},
],
},
{
displayName: 'Preserve Formatting',
name: 'preserveFormatting',
type: 'options',
default: '0',
description:
'Whether the translation engine should respect the original formatting, even if it would usually correct some aspects',
options: [
{
name: 'Apply Corrections',
value: '0',
description:
'Fix punctuation at the beginning and end of sentences and fixes lower/upper caseing at the beginning',
},
{
name: 'Do Not Correct',
value: '1',
description: 'Keep text as similar as possible to the original',
},
],
},
{
displayName: 'Formality',
name: 'formality',
type: 'options',
default: 'default',
description:
'How formal or informal the target text should be. May not be supported with all languages.',
options: [
{
name: 'Formal',
value: 'more',
},
{
name: 'Informal',
value: 'less',
},
{
name: 'Neutral',
value: 'default',
},
],
},
],
},
];
@@ -0,0 +1,12 @@
{
"type": "object",
"properties": {
"detected_source_language": {
"type": "string"
},
"text": {
"type": "string"
}
},
"version": 1
}
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 16 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 16 KiB