{
  "name": "DzRouter · 02 · Traducteur FR · AR · Darja · EN",
  "nodes": [
    {
      "id": "5cd78c0e-db06-5aad-8039-aaf83f2be624",
      "name": "Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        -260
      ],
      "parameters": {
        "content": "## Traducteur (outil formulaire)\n\n1. Installez le nœud communautaire **n8n-nodes-dzrouter** (Paramètres → Community nodes).\n2. Ouvrez chaque nœud DzRouter et choisissez votre identifiant **DzRouter API** (clé `sk-dz-…`).\n3. Cliquez **Test workflow** : un exemple algérien est déjà chargé.\n\n---\n\n<div dir=\"rtl\">\n\n### مترجم\n\n1. ثبّت العقدة **n8n-nodes-dzrouter** (الإعدادات ← Community nodes).\n2. افتح كل عقدة DzRouter واختر بيانات اعتماد **DzRouter API** (مفتاح `sk-dz-…`).\n3. اضغط **Test workflow**: مثال جزائري جاهز للتجربة.\n\n</div>\n\n---\n\n### Translator (form tool)\n\n1. Install the **n8n-nodes-dzrouter** community node (Settings → Community nodes).\n2. Open each DzRouter node and pick your **DzRouter API** credential (`sk-dz-…` key).\n3. Click **Test workflow**: an Algerian sample is already loaded.",
        "height": 560,
        "width": 440,
        "color": 4
      }
    },
    {
      "id": "375d6e41-54e3-5edb-b510-4f5b6976b118",
      "name": "Form",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.3,
      "position": [
        0,
        0
      ],
      "parameters": {
        "formTitle": "🌍 Traducteur DzRouter",
        "formDescription": "Français · العربية · Darja · English · Taqbaylit",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Texte",
              "fieldType": "textarea",
              "requiredField": true
            },
            {
              "fieldLabel": "Traduire vers",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Darja algérienne"
                  },
                  {
                    "option": "Arabe littéraire"
                  },
                  {
                    "option": "Français"
                  },
                  {
                    "option": "Anglais"
                  },
                  {
                    "option": "Kabyle (Taqbaylit)"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldLabel": "Ton",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Comme l'original"
                  },
                  {
                    "option": "Formel"
                  },
                  {
                    "option": "Informel"
                  }
                ]
              }
            }
          ]
        },
        "responseMode": "lastNode",
        "options": {
          "appendAttribution": false
        }
      }
    },
    {
      "id": "44374c84-7207-5449-8bc7-66148ccfd71c",
      "name": "Translate",
      "type": "n8n-nodes-dzrouter.dzRouter",
      "typeVersion": 1,
      "position": [
        260,
        0
      ],
      "parameters": {
        "resource": "text",
        "operation": "translate",
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "openai/gpt-4o-mini"
        },
        "text": "={{ $json.Texte }}",
        "targetLanguage": "other",
        "customLanguage": "={{ ({'Darja algérienne':'Algerian Arabic (Darja), written in Arabic script','Arabe littéraire':'Modern Standard Arabic','Français':'French','Anglais':'English','Kabyle (Taqbaylit)':'Kabyle (Taqbaylit), written in Latin script'})[$json['Traduire vers']] }}",
        "options": {
          "tone": "={{ ({'Formel':'formal','Informel':'informal'})[$json.Ton] || '' }}"
        }
      }
    },
    {
      "id": "8f6f582d-9158-5d00-baeb-a1f943bb24d2",
      "name": "Build page",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        520,
        0
      ],
      "parameters": {
        "jsCode": "const esc = (s) => String(s ?? '').replace(/[&<>\"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '\"': '&quot;' }[c]));\nconst page = (title, body) => `<div style=\"font-family:system-ui,Segoe UI,Tahoma,sans-serif;max-width:720px;margin:0 auto;line-height:1.6;color:#0f1c16\">\n<h2 style=\"color:#007f00;margin:0 0 12px\">${esc(title)}</h2>${body}\n<p style=\"color:#4f6158;font-size:13px;margin-top:24px\">Généré avec DzRouter · dzrouter.com</p></div>`;\n\nconst t = $('Translate').first().json.translation;\nconst target = $('Form').first().json['Traduire vers'];\nreturn [{ json: { html: page('🌍 ' + target, `<div dir=\"auto\" style=\"font-size:18px;padding:14px;background:#f1f6f2;border-radius:8px\">${esc(t).replace(/\\n/g, '<br>')}</div>`) } }];"
      }
    },
    {
      "id": "d0f3c312-cbd7-562c-80fb-bfb05becca36",
      "name": "Show result",
      "type": "n8n-nodes-base.form",
      "typeVersion": 2.3,
      "position": [
        780,
        0
      ],
      "parameters": {
        "operation": "completion",
        "respondWith": "showText",
        "responseText": "={{ $json.html }}"
      }
    }
  ],
  "connections": {
    "Form": {
      "main": [
        [
          {
            "node": "Translate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate": {
      "main": [
        [
          {
            "node": "Build page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build page": {
      "main": [
        [
          {
            "node": "Show result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {
    "Form": [
      {
        "json": {
          "Texte": "Bonjour, votre commande sera livrée demain entre 10h et 14h. Merci de garder votre téléphone allumé.",
          "Traduire vers": "Darja algérienne",
          "Ton": "Informel",
          "submittedAt": "2026-10-13T10:00:00.000+01:00",
          "formMode": "test"
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false,
    "templateId": "dzrouter"
  }
}
