# Translate

## /translate

This endpoint translates text from one language to another based on the provided parameters. It accepts a GET request with query parameters including the `text`, `fromLang`, and `toLang`. If any of these parameters are missing, it returns a custom HTML page indicating missing parameters. If the translation is successful, it returns the original text along with its translation. If the translation fails or an error occurs, it returns a corresponding error message with a status code of 500.

### Query Parameters

| Parameter | Type   | Description                                          |
| --------- | ------ | ---------------------------------------------------- |
| text      | string | The text to be translated.                           |
| fromLang  | string | The language code of the text to be translated from. |
| toLang    | string | The language code of the text to be translated to.   |

### Example Usage

Translate "Hello, how are you?" from English to Spanish:

`GET /translate?text=Hello how are you&fromLang=en&toLang=es`

### Example Response

```
{
  "originalText": "Hello, how are you?",
  "translatedText": "¡Hola, ¿cómo estás?"
}
```

### Languages Supported

Go find all the language codes and their corresponding ISO 639-1 or RFC3066 codes online or in language code standards documentation.


---

# 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://docs.ziomark.xyz/get-endpoints/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.
