# Translate

### NodeJS

```javascript
const text = await getText("http://www.cloudbrowser.ai", "h1");

if (!text) return;

const rp = await ai.translate({
  text: text,
  isoLang: "ES",
});

console.log(rp.response);
```

### .NET

```csharp
var text = await GetText("http://www.cloudbrowser.ai","h1").ConfigureAwait(false);

if (text == null) return;

var rp = await ai.Translate(new() {
  Text=text,
  IsoLang="ES"
}).ConfigureAwait(false);

Console.WriteLine("{0}", rp.Response);
```

### **/api/v1/ai/Translate – Translate Text into a Specified Language**

**Method**:\
`POST`

**Parameters**:

* `text`: *(string)* – The text to translate.
* `isoLang`: *(string)* – The ISO language code for the target language (e.g., `fr` for French).
* `responseFormat`: *(string)* – The format of the response (e.g., `text`, `json`).

**Request Example**:

```bash
curl -X POST https://production.cloudbrowser.ai/api/v1/ai/Translate \
-H "Content-Type: application/json" \
-d '{
  "text": "Hello, world!",
  "isoLang": "fr",
  "responseFormat": "text"
}'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cloudbrowser.gitbook.io/docs/configurations/ai-functions/translate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
