8
n8n 中文网amn8n.com

自动翻译Google Slides演示文稿

高级

这是一个Document Extraction, Multimodal AI领域的自动化工作流,包含 18 个节点。主要使用 Set, Code, Wait, SplitOut, GoogleDrive 等节点。 基于Gemini的AI驱动自动翻译Google Slides演示文稿至任意语言

前置要求
  • Google Drive API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "RsBtAMu8K66veIXY",
  "meta": {
    "instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
    "templateCredsSetupCompleted": true
  },
  "name": "自动翻译 Google Slides 演示文稿",
  "tags": [],
  "nodes": [
    {
      "id": "ebcadd07-05d8-4697-a3f7-e26c4bd45209",
      "name": "当点击“执行工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -624,
        -80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "2b24ed35-54ec-4bbe-9679-727a7628c0ac",
      "name": "从演示文稿获取幻灯片",
      "type": "n8n-nodes-base.googleSlides",
      "position": [
        80,
        -80
      ],
      "parameters": {
        "operation": "getSlides",
        "presentationId": "={{ $json.id }}"
      },
      "credentials": {
        "googleSlidesOAuth2Api": {
          "id": "HuT9vQXbjmHQ0YQD",
          "name": "Google Slides account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "a1ccda01-d0b1-4434-a1dd-ca17c2a1179e",
      "name": "Google Gemini聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        400,
        384
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "AaNPKXAphyMzRgfA",
          "name": "Google Gemini(PaLM) (Eure)"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9185e2de-fd63-47a6-b2b9-79d251a85140",
      "name": "翻译 Google Slides",
      "type": "n8n-nodes-base.googleSlidesTool",
      "position": [
        752,
        416
      ],
      "parameters": {
        "textUi": {
          "textValues": [
            {
              "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('textValues0_Search_For', ``, 'string') }}",
              "matchCase": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('textValues0_Match_Case', ``, 'boolean') }}",
              "replaceText": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('textValues0_Replace_With', ``, 'string') }}",
              "pageObjectIds": "={{ $('When Executed by Another Workflow').item.json.objectId }}"
            }
          ]
        },
        "options": {},
        "operation": "replaceText",
        "presentationId": "={{ $('When Executed by Another Workflow').item.json.presentationId }}"
      },
      "credentials": {
        "googleSlidesOAuth2Api": {
          "id": "HuT9vQXbjmHQ0YQD",
          "name": "Google Slides account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "5ee73a74-b554-489b-8ca2-861ae5afaea9",
      "name": "分离输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        816,
        -64
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "extractTexts"
      },
      "typeVersion": 1
    },
    {
      "id": "b2c99a24-48af-45e2-9420-a76a147e0f61",
      "name": "执行工作流",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        1008,
        -64
      ],
      "parameters": {
        "options": {},
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "RsBtAMu8K66veIXY"
        },
        "workflowInputs": {
          "value": {
            "lang": "={{ $('Set Language').item.json.lang }}",
            "objectId": "={{ $('Extract Text').item.json.objectId }}",
            "extractTexts": "={{ $json.extractTexts }}",
            "presentationId": "={{ $('Duplicate presentation').item.json.id }}"
          },
          "schema": [
            {
              "id": "objectId",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "objectId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "lang",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "lang",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "presentationId",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "presentationId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "extractTexts",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "extractTexts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": true,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a9682dde-b5d5-46de-92b3-861a459d9e16",
      "name": "当被其他工作流执行时",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        16,
        208
      ],
      "parameters": {
        "inputSource": "jsonExample",
        "jsonExample": "{\n  \"objectId\": \"a string\",\n  \"lang\": \"a string\",\n  \"presentationId\": \"a string\",\n  \"extractTexts\": \"a string\" \n}\n\n"
      },
      "typeVersion": 1.1
    },
    {
      "id": "bd0f34c0-414f-43ac-b30c-751e21bd7f92",
      "name": "复制演示文稿",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -176,
        -80
      ],
      "parameters": {
        "name": "=Presentation_{{ $json.lang }}_{{$now.format('yyyyLLddHHii')}}",
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "=XXXXXXX"
        },
        "options": {},
        "operation": "copy"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "HEy5EuZkgPZVEa9w",
          "name": "Google Drive account (n3w.it)"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "4d75421a-ee3a-4d80-9e8d-d42de564d879",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        352,
        -80
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "bb40c6fc-7f6e-401d-b8f1-e2240890b936",
      "name": "提取文本",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        -64
      ],
      "parameters": {
        "jsCode": "// Estrai i testi e restituisci anche l'objectId della slide\nconst results = [];\n\nfor (const item of $input.all()) {\n  const objectId = item.json.objectId;\n  const texts = [];\n\n  const pageElements = item.json.pageElements || [];\n\n  for (const element of pageElements) {\n    const textElements = element?.shape?.text?.textElements || [];\n\n    for (const textElement of textElements) {\n      if (textElement.textRun?.content) {\n        texts.push(textElement.textRun.content);\n      }\n    }\n  }\n\n  results.push({\n    json: {\n      objectId,\n      extractTexts: texts\n    }\n  });\n}\n\nreturn results;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "475c9fef-ceb0-4cf6-a50f-568dd9fa8f56",
      "name": "等待 10 秒",
      "type": "n8n-nodes-base.wait",
      "position": [
        1184,
        -64
      ],
      "webhookId": "5ee20223-84d9-4812-8919-f189ac93f841",
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    },
    {
      "id": "09f07da1-e3e0-4193-8444-26d08d36687b",
      "name": "等待 3 秒",
      "type": "n8n-nodes-base.wait",
      "position": [
        832,
        208
      ],
      "webhookId": "9152728c-a3a1-4f0e-8571-b636b72acd5a",
      "parameters": {
        "amount": 3
      },
      "typeVersion": 1.1
    },
    {
      "id": "07a95504-11c9-4aeb-b033-e97ea6b1959e",
      "name": "翻译专家",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        432,
        208
      ],
      "parameters": {
        "text": "=Text to translate:\n{{ $json.extractTexts }}",
        "options": {
          "systemMessage": "=You are an expert Google Slides translator. Your primary function is to translate slides sent to you to {{ $json.lang }} (Code ISO-639) using the tool \"Translate language\" for better performs and then use the \"Translate Google Slide\" tool.\n\n## Translation Guidelines:\n\n**TRANSLATE:**\n- All text content in slides\n\n**DO NOT TRANSLATE:**\n- Email addresses (e.g., info@company.com)\n- Website URLs and links (e.g., www.example.it)\n- Physical addresses and locations\n- Phone numbers\n- Company names and brand names\n- Proper nouns (names of people, places, organizations)\n- Any other information that should remain in the original language\n\n## Process:\n1. Receive the Google Slides document\n2. Identify all text elements that require translation\n3. Use the \"Translate Google Slide\" tool to perform the translation from Italian to English\n4. Ensure proper context and professional tone in the English translation\n5. Maintain the original formatting and structure of the slides\n\n## Quality Standards:\n- Provide accurate, contextually appropriate translations\n- Maintain professional terminology and tone\n- Preserve the original meaning and intent\n- Ensure readability and flow in English"
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "56236111-f91a-457b-a209-6ddd561fce2d",
      "name": "设置语言",
      "type": "n8n-nodes-base.set",
      "position": [
        -416,
        -80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "534bdd67-f789-4064-9da5-f958a73c9f89",
              "name": "lang",
              "type": "string",
              "value": "zh-CN"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c4b91198-16a8-4f74-a014-77ace950442c",
      "name": "翻译语言",
      "type": "n8n-nodes-base.googleTranslateTool",
      "position": [
        592,
        416
      ],
      "parameters": {
        "text": "={{ $json.extractTexts }}",
        "translateTo": "={{ $json.lang }}"
      },
      "credentials": {
        "googleTranslateOAuth2Api": {
          "id": "182fiZUZeAOHI9Y5",
          "name": "Google Translate account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "26e239f5-2035-4baa-a934-991f12ae82d2",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -688
      ],
      "parameters": {
        "color": 3,
        "width": 784,
        "height": 240,
        "content": "## AI 驱动的 Google Slides 演示文稿自动翻译至任意语言"
      },
      "typeVersion": 1
    },
    {
      "id": "d7fccf24-7d3a-45d8-b7cc-d33f63ec0219",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -416
      ],
      "parameters": {
        "width": 784,
        "height": 112,
        "content": "## 步骤 1"
      },
      "typeVersion": 1
    },
    {
      "id": "263322f3-2059-41cd-88ec-4ccd5003c03c",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -272
      ],
      "parameters": {
        "width": 784,
        "height": 112,
        "content": "## 步骤 2"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3b5ab2a4-83cc-4cd2-b0f3-e67088417c8e",
  "connections": {
    "Split Out": {
      "main": [
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 3 sec": {
      "main": [
        []
      ]
    },
    "Wait 10 sec": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Language": {
      "main": [
        [
          {
            "node": "Duplicate presentation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Extract Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow": {
      "main": [
        [
          {
            "node": "Wait 10 sec",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate language": {
      "ai_tool": [
        [
          {
            "node": "Translation expert",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Translation expert": {
      "main": [
        [
          {
            "node": "Wait 3 sec",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Duplicate presentation": {
      "main": [
        [
          {
            "node": "Get slides from a presentation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate Google Slides": {
      "ai_tool": [
        [
          {
            "node": "Translation expert",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Translation expert",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get slides from a presentation": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Translation expert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Set Language",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 文档提取, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量18
分类2
节点类型15
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者

Full-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at info@n3w.it or add me on Linkedin.com/in/davideboizza

外部链接
在 n8n.io 查看

分享此工作流