{
  "name": "Language Translation Workflow",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "id": "start-node",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "sentence",
              "value": "Hello, how are you today?"
            },
            {
              "name": "target_language",
              "value": "spanish"
            }
          ]
        },
        "options": {}
      },
      "id": "set-input-data",
      "name": "Set Input Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "dataType": "string",
        "value1": "={{ $json.target_language }}",
        "rules": {
          "rules": [
            {
              "value2": "spanish",
              "output": 0
            },
            {
              "value2": "french",
              "output": 1
            },
            {
              "value2": "german",
              "output": 2
            },
            {
              "value2": "italian",
              "output": 3
            },
            {
              "value2": "portuguese",
              "output": 4
            },
            {
              "value2": "japanese",
              "output": 5
            },
            {
              "value2": "chinese",
              "output": 6
            },
            {
              "value2": "korean",
              "output": 7
            }
          ]
        },
        "fallbackOutput": 8
      },
      "id": "language-switch",
      "name": "Language Switch",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "create",
        "model": "gpt-3.5-turbo",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the given text to Spanish. Only return the translation, no explanations."
            },
            {
              "role": "user",
              "content": "={{ $json.sentence }}"
            }
          ]
        },
        "options": {
          "temperature": 0.3,
          "maxTokens": 150
        }
      },
      "id": "translate-spanish",
      "name": "Translate to Spanish",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        900,
        100
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "create",
        "model": "gpt-3.5-turbo",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the given text to French. Only return the translation, no explanations."
            },
            {
              "role": "user",
              "content": "={{ $json.sentence }}"
            }
          ]
        },
        "options": {
          "temperature": 0.3,
          "maxTokens": 150
        }
      },
      "id": "translate-french",
      "name": "Translate to French",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        900,
        200
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "create",
        "model": "gpt-3.5-turbo",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the given text to German. Only return the translation, no explanations."
            },
            {
              "role": "user",
              "content": "={{ $json.sentence }}"
            }
          ]
        },
        "options": {
          "temperature": 0.3,
          "maxTokens": 150
        }
      },
      "id": "translate-german",
      "name": "Translate to German",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        900,
        300
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "create",
        "model": "gpt-3.5-turbo",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the given text to Italian. Only return the translation, no explanations."
            },
            {
              "role": "user",
              "content": "={{ $json.sentence }}"
            }
          ]
        },
        "options": {
          "temperature": 0.3,
          "maxTokens": 150
        }
      },
      "id": "translate-italian",
      "name": "Translate to Italian",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        900,
        400
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "create",
        "model": "gpt-3.5-turbo",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the given text to Portuguese. Only return the translation, no explanations."
            },
            {
              "role": "user",
              "content": "={{ $json.sentence }}"
            }
          ]
        },
        "options": {
          "temperature": 0.3,
          "maxTokens": 150
        }
      },
      "id": "translate-portuguese",
      "name": "Translate to Portuguese",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        900,
        500
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "create",
        "model": "gpt-3.5-turbo",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the given text to Japanese. Only return the translation, no explanations."
            },
            {
              "role": "user",
              "content": "={{ $json.sentence }}"
            }
          ]
        },
        "options": {
          "temperature": 0.3,
          "maxTokens": 150
        }
      },
      "id": "translate-japanese",
      "name": "Translate to Japanese",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        900,
        600
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "create",
        "model": "gpt-3.5-turbo",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the given text to Chinese (Simplified). Only return the translation, no explanations."
            },
            {
              "role": "user",
              "content": "={{ $json.sentence }}"
            }
          ]
        },
        "options": {
          "temperature": 0.3,
          "maxTokens": 150
        }
      },
      "id": "translate-chinese",
      "name": "Translate to Chinese",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        900,
        700
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "create",
        "model": "gpt-3.5-turbo",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the given text to Korean. Only return the translation, no explanations."
            },
            {
              "role": "user",
              "content": "={{ $json.sentence }}"
            }
          ]
        },
        "options": {
          "temperature": 0.3,
          "maxTokens": 150
        }
      },
      "id": "translate-korean",
      "name": "Translate to Korean",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        900,
        800
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "create",
        "model": "gpt-3.5-turbo",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Please translate the given text to the requested language. Only return the translation, no explanations."
            },
            {
              "role": "user",
              "content": "Translate this to {{ $json.target_language }}: {{ $json.sentence }}"
            }
          ]
        },
        "options": {
          "temperature": 0.3,
          "maxTokens": 150
        }
      },
      "id": "translate-fallback",
      "name": "Translate (Fallback)",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        900,
        900
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "original_sentence",
              "value": "={{ $('Set Input Data').item.json.sentence }}"
            },
            {
              "name": "target_language",
              "value": "={{ $('Set Input Data').item.json.target_language }}"
            },
            {
              "name": "translated_text",
              "value": "={{ $json.choices[0].message.content }}"
            }
          ]
        },
        "options": {}
      },
      "id": "format-output",
      "name": "Format Output",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        1120,
        450
      ]
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Set Input Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Input Data": {
      "main": [
        [
          {
            "node": "Language Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Language Switch": {
      "main": [
        [
          {
            "node": "Translate to Spanish",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Translate to French",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Translate to German",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Translate to Italian",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Translate to Portuguese",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Translate to Japanese",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Translate to Chinese",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Translate to Korean",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Translate (Fallback)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to Spanish": {
      "main": [
        [
          {
            "node": "Format Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to French": {
      "main": [
        [
          {
            "node": "Format Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to German": {
      "main": [
        [
          {
            "node": "Format Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to Italian": {
      "main": [
        [
          {
            "node": "Format Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to Portuguese": {
      "main": [
        [
          {
            "node": "Format Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to Japanese": {
      "main": [
        [
          {
            "node": "Format Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to Chinese": {
      "main": [
        [
          {
            "node": "Format Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate to Korean": {
      "main": [
        [
          {
            "node": "Format Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate (Fallback)": {
      "main": [
        [
          {
            "node": "Format Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "translation-workflow",
  "tags": []
}