Skip to content

Instantly share code, notes, and snippets.

@MrOplus
Created September 9, 2025 06:53
Show Gist options
  • Select an option

  • Save MrOplus/1436ec3c8d84e8a692e6e98f7807d4aa to your computer and use it in GitHub Desktop.

Select an option

Save MrOplus/1436ec3c8d84e8a692e6e98f7807d4aa to your computer and use it in GitHub Desktop.
Translate Subtitle N8N Workflow
{
"nodes": [
{
"parameters": {
"formTitle": "Subtitle Translation",
"formFields": {
"values": [
{
"fieldLabel": "subtitle",
"fieldType": "file",
"acceptFileTypes": ".srt",
"requiredField": true
},
{
"fieldLabel": "language",
"placeholder": "Translation Language",
"requiredField": true
}
]
},
"options": {}
},
"type": "n8n-nodes-base.formTrigger",
"typeVersion": 2.3,
"position": [
-208,
-48
],
"id": "25b3366c-2b99-4c80-aa13-e600bf7de1e9",
"name": "On form submission",
"webhookId": "e83bd0ab-ec3b-4788-a64b-8c1c23389a66"
},
{
"parameters": {
"operation": "text",
"binaryPropertyName": "subtitle",
"options": {}
},
"type": "n8n-nodes-base.extractFromFile",
"typeVersion": 1,
"position": [
80,
-64
],
"id": "0eaaf501-caba-4d1a-92e0-180f5e4d1a0f",
"name": "Extract from File"
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "claude-sonnet-4-20250514",
"cachedResultName": "Claude 4 Sonnet"
},
"options": {
"maxTokensToSample": 128000
}
},
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"typeVersion": 1.3,
"position": [
224,
144
],
"id": "1bd01965-7512-4443-93a9-686de08beadf",
"name": "Anthropic Chat Model",
"credentials": {
"anthropicApi": {
"id": "WPxJMvNupBE9ADTG",
"name": "Anthropic account"
}
}
},
{
"parameters": {
"operation": "completion",
"respondWith": "returnBinary",
"completionTitle": "Translated Subtitle",
"options": {}
},
"type": "n8n-nodes-base.form",
"typeVersion": 2.3,
"position": [
848,
-64
],
"id": "67b625e2-a479-41cf-9e5f-3cf6f7424d0c",
"name": "Form",
"webhookId": "b8b49a11-a853-40ef-98e8-47f5e5f141b3"
},
{
"parameters": {
"operation": "toText",
"sourceProperty": "text",
"options": {
"fileName": "translated.srt"
}
},
"type": "n8n-nodes-base.convertToFile",
"typeVersion": 1.1,
"position": [
640,
-64
],
"id": "df6a67eb-9cff-410a-8089-25a62428f01a",
"name": "Convert to File"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.data }}",
"messages": {
"messageValues": [
{
"message": "=You are a subtitle translator. Your task is to translate the input subtitle file (in .srt format) into {{ $('On form submission').item.json.language }}.\n\nRules:\n\nKeep timing exactly as it is.\n\nTranslate naturally - the output must sound like real, everyday human conversation, not a literal or book-style translation.\n\nDo not add or remove any information. Only translate the given text.\n\nTranslate sentence by sentence, not word by word.\n\nExample: The English phrase “Fire in the hole” should be translated into Persian as “انفجار!” (not “آتش در سوراخ”).\n\nYour translation should always read as if spoken naturally in the target language."
}
]
},
"batching": {}
},
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"typeVersion": 1.7,
"position": [
288,
-64
],
"id": "60a212ef-07c7-478a-bbe6-9e5ab395869a",
"name": "Translator"
}
],
"connections": {
"On form submission": {
"main": [
[
{
"node": "Extract from File",
"type": "main",
"index": 0
}
]
]
},
"Extract from File": {
"main": [
[
{
"node": "Translator",
"type": "main",
"index": 0
}
]
]
},
"Anthropic Chat Model": {
"ai_languageModel": [
[
{
"node": "Translator",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Convert to File": {
"main": [
[
{
"node": "Form",
"type": "main",
"index": 0
}
]
]
},
"Translator": {
"main": [
[
{
"node": "Convert to File",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "6b0b2f72880a6609c9b1a6926abf70f3a56de7470b8c07e76c82825e3685715d"
}
}
@Aliasgharmahmudi
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment