# Translate Text — Translate.com

> Translante a text using machine. [See the documentation](https://translation-api.translate.com/api/documentation?_gl=11qes1da_gaMTMwNzkzMTg3OC4xNjk1NDE3MDIy_ga_T51KL347BB*MTY5NTQxNzAyMS4xLjAuMTY5NTQxNzAyMS42MC4wLjA.#/Machine Translation)

- Key: `translate_com-translate-text`
- Type: Action (Write)
- Version: 0.0.2
- App: Translate.com (`translate_com`) — https://pipedream.com/apps/translate-com.md
- This page (HTML): https://pipedream.com/apps/translate-com/actions/translate-text
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/translate_com/actions/translate-text/translate-text.mjs

## Description

Translante a text using machine. [See the documentation](https://translation-api.translate.com/api/documentation?_gl=1*1qes1da*_ga*MTMwNzkzMTg3OC4xNjk1NDE3MDIy*_ga_T51KL347BB*MTY5NTQxNzAyMS4xLjAuMTY5NTQxNzAyMS42MC4wLjA.#/Machine Translation)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `sourceLanguage` | `string` | Yes | The language of the source text Options are loaded from the connected account. |
| `translationLanguage` | `string` | Yes | The translation language Options are loaded from the connected account. |
| `text` | `string` | Yes | Text to be translated |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "translate_com",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "translate_com-translate-text",
  arguments: {
    sourceLanguage: "Source language",
    translationLanguage: "Translation language",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "translate_com-translate-text",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    translate_com: { authProvisionId: "apn_xxxxxxx" },
    sourceLanguage: "Source language",
    translationLanguage: "Translation language",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "translate_com-translate-text",
    "configured_props": {
      "translate_com": { "authProvisionId": "apn_xxxxxxx" },
      "sourceLanguage": "Source language",
      "translationLanguage": "Translation language"
    }
  }'
```

---

- App: https://pipedream.com/apps/translate-com.md · All apps: https://pipedream.com/apps
