{
  "name": "Language Translation with OpenAI",
  "nodes": [
    {
      "parameters": {
        "formTitle": "Translate Text",
        "formDescription": "Enter a sentence and select the target language for translation",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Text to Translate",
              "fieldType": "string",
              "name": "textToTranslate",
              "requiredField": true
            },
            {
              "fieldLabel": "Target Language",
              "fieldType": "options",
              "name": "targetLanguage",
              "requiredField": true,
              "fieldOptions": {
                "values": [
                  {
                    "option": "Spanish"
                  },
                  {
                    "option": "French"
                  },
                  {
                    "option": "German"
                  },
                  {
                    "option": "Italian"
                  },
                  {
                    "option": "Portuguese"
                  },
                  {
                    "option": "Japanese"
                  },
                  {
                    "option": "Chinese (Simplified)"
                  },
                  {
                    "option": "Korean"
                  },
                  {
                    "option": "Arabic"
                  },
                  {
                    "option": "Russian"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "id": "manual-trigger",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "dataType": "string",
        "value1": "={{ $json.targetLanguage }}",
        "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 (Simplified)",
              "output": 6
            },
            {
              "value2": "Korean",
              "output": 7
            },
            {
              "value2": "Arabic",
              "output": 8
            },
            {
              "value2": "Russian",
              "output": 9
            }
          ]
        },
        "fallbackOutput": "none"
      },
      "id": "switch-language",
      "name": "Switch Language",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the following text to Spanish. Provide only the translation without any explanations or additional text."
            },
            {
              "role": "user",
              "content": "={{ $('manual-trigger').item.json.textToTranslate }}"
            }
          ]
        }
      },
      "id": "openai-spanish",
      "name": "Translate to Spanish",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        700,
        50
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the following text to French. Provide only the translation without any explanations or additional text."
            },
            {
              "role": "user",
              "content": "={{ $('manual-trigger').item.json.textToTranslate }}"
            }
          ]
        }
      },
      "id": "openai-french",
      "name": "Translate to French",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        700,
        150
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the following text to German. Provide only the translation without any explanations or additional text."
            },
            {
              "role": "user",
              "content": "={{ $('manual-trigger').item.json.textToTranslate }}"
            }
          ]
        }
      },
      "id": "openai-german",
      "name": "Translate to German",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        700,
        250
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the following text to Italian. Provide only the translation without any explanations or additional text."
            },
            {
              "role": "user",
              "content": "={{ $('manual-trigger').item.json.textToTranslate }}"
            }
          ]
        }
      },
      "id": "openai-italian",
      "name": "Translate to Italian",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        700,
        350
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the following text to Portuguese. Provide only the translation without any explanations or additional text."
            },
            {
              "role": "user",
              "content": "={{ $('manual-trigger').item.json.textToTranslate }}"
            }
          ]
        }
      },
      "id": "openai-portuguese",
      "name": "Translate to Portuguese",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        700,
        450
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the following text to Japanese. Provide only the translation without any explanations or additional text."
            },
            {
              "role": "user",
              "content": "={{ $('manual-trigger').item.json.textToTranslate }}"
            }
          ]
        }
      },
      "id": "openai-japanese",
      "name": "Translate to Japanese",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        700,
        550
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the following text to Simplified Chinese. Provide only the translation without any explanations or additional text."
            },
            {
              "role": "user",
              "content": "={{ $('manual-trigger').item.json.textToTranslate }}"
            }
          ]
        }
      },
      "id": "openai-chinese",
      "name": "Translate to Chinese",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        700,
        650
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the following text to Korean. Provide only the translation without any explanations or additional text."
            },
            {
              "role": "user",
              "content": "={{ $('manual-trigger').item.json.textToTranslate }}"
            }
          ]
        }
      },
      "id": "openai-korean",
      "name": "Translate to Korean",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        700,
        750
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the following text to Arabic. Provide only the translation without any explanations or additional text."
            },
            {
              "role": "user",
              "content": "={{ $('manual-trigger').item.json.textToTranslate }}"
            }
          ]
        }
      },
      "id": "openai-arabic",
      "name": "Translate to Arabic",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        700,
        850
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional translator. Translate the following text to Russian. Provide only the translation without any explanations or additional text."
            },
            {
              "role": "user",
              "content": "={{ $('manual-trigger').item.json.textToTranslate }}"
            }
          ]
        }
      },
      "id": "openai-russian",
      "name": "Translate to Russian",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        700,
        950
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "originalText",
              "value": "={{ $('manual-trigger').item.json.textToTranslate }}"
            },
            {
              "name": "targetLanguage",
              "value": "={{ $('manual-trigger').item.json.targetLanguage }}"
            },
            {
              "name": "translatedText",
              "value": "={{ $json.choices[0].message.content }}"
            }
          ]
        },
        "options": {}
      },
      "id": "set-output",
      "name": "Format Output",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        950,
        500
      ]
    }
  ],
  "connections": {
    "manual-trigger": {
      "main": [
        [
          {
            "node": "switch-language",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "switch-language": {
      "main": [
        [
          {
            "node": "openai-spanish",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "openai-french",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "openai-german",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "openai-italian",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "openai-portuguese",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "openai-japanese",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "openai-chinese",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "openai-korean",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "openai-arabic",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "openai-russian",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai-spanish": {
      "main": [
        [
          {
            "node": "set-output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai-french": {
      "main": [
        [
          {
            "node": "set-output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai-german": {
      "main": [
        [
          {
            "node": "set-output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai-italian": {
      "main": [
        [
          {
            "node": "set-output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai-portuguese": {
      "main": [
        [
          {
            "node": "set-output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai-japanese": {
      "main": [
        [
          {
            "node": "set-output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai-chinese": {
      "main": [
        [
          {
            "node": "set-output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai-korean": {
      "main": [
        [
          {
            "node": "set-output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai-arabic": {
      "main": [
        [
          {
            "node": "set-output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai-russian": {
      "main": [
        [
          {
            "node": "set-output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1.0.0",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "language-translation-001",
  "tags": []
}