---
title: ToolRouter — Tool Detail
description: Detailed documentation for a ToolRouter tool including skills, parameters, and examples.
url: https://toolrouter.com/tools/translate
---
# Translate

Professional translations across 30+ languages with formality control, context hints, and HTML/XML handling. Translate strings or batches, auto-detect source language, and preserve markup. For support tools, content pipelines, and multilingual apps.

- **Version:** 0.02
- **Categories:** data, communication, productivity

## Skills (3)

### Translate Text (`translate_text`)

Translate one or more texts into any target language. Supports auto-detection of source language, formality control (formal/informal), contextual hints for better accuracy, and HTML/XML tag handling. Pass an array for batch translation.

**Parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `text` | undefined | Yes | Text to translate. A single string or an array of strings for batch translation. |
| `target_lang` | string | Yes | Target language code (e.g. "DE", "FR", "ES", "JA", "ZH", "EN-US", "EN-GB", "PT-BR"). Use list_languages to see all supported codes. |
| `source_lang` | string | No | Source language code. If omitted, the language is auto-detected. |
| `formality` | string | No | Formality: "more" = formal, "less" = informal. "prefer_more"/"prefer_less" = best effort. Not all target languages supported. (default, more, less, prefer_more, prefer_less) |
| `context` | string | No | Context that influences translation but is not translated. Disambiguates meaning (e.g. "banking context" when translating "bank"). |
| `tag_handling` | string | No | Specifies tag handling: "html" or "xml". Tags are preserved and content within them is translated appropriately. (html, xml) |
| `split_sentences` | string | No | Controls sentence splitting. "0" = no splitting, "1" = split on punctuation + newlines (default), "nonewlines" = split on punctuation only. (0, 1, nonewlines) |
| `preserve_formatting` | string | No | Whether to preserve formatting. "1" = preserve original formatting (default). (0, 1) |
| `model_type` | string | No | Model: "quality_optimized" = best quality, "latency_optimized" = fastest, "prefer_quality_optimized" = default. (quality_optimized, latency_optimized, prefer_quality_optimized) |

**Returns:** Translated text(s) with detected source language, target language used, and character count for billing

**Examples:**

*Translate English to German:*

```json
{
  "text": "Hello, how are you?",
  "target_lang": "DE"
}
```

*Translate formally to French:*

```json
{
  "text": "Please send me the report by Friday.",
  "target_lang": "FR",
  "formality": "more"
}
```

*Batch translate to Japanese:*

```json
{
  "text": [
    "Good morning",
    "Thank you",
    "Goodbye"
  ],
  "target_lang": "JA"
}
```

*Translate with context for disambiguation:*

```json
{
  "text": "I need to go to the bank.",
  "target_lang": "ES",
  "context": "The speaker is going to a financial institution to deposit money."
}
```

### Detect Language (`detect_language`)

Detect the language of a given text. Returns the detected language code and a sample translation to English for verification.

**Parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `text` | string | Yes | Text whose language you want to detect |

**Returns:** Detected language code with a sample English translation for verification

**Examples:**

*Detect the language of a German sentence:*

```json
{
  "text": "Wie geht es Ihnen heute?"
}
```

### List Languages (`list_languages`)

List all supported languages for translation. Can show source languages (translate from) or target languages (translate to) with formality support info.

**Parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `type` | string | No | "source" = languages you can translate from, "target" = languages you can translate to (default). Target languages include formality support info. (source, target) [default: "target"] |

**Returns:** List of supported languages with codes, names, and formality support indicators

**Examples:**

*List all target languages:*

```json
{
  "type": "target"
}
```

*List all source languages:*

```json
{
  "type": "source"
}
```

## Quick Start

```bash
# Via CLI
TOOLROUTER_API_KEY=tr_live_xxx npx -y toolrouter-mcp call translate translate_text --text Hello, how are you? --target_lang DE

# Via REST API
curl -H "Authorization: Bearer tr_live_xxx" \
     -d '{"tool":"translate","skill":"translate_text","input":{"text":"Hello, how are you?","target_lang":"DE"}}' \
     https://api.toolrouter.com/v1/tools/call
```

## Frequently Asked Questions

### Can I translate a batch of strings at once?

Yes. `translate_text` accepts a single string or an array of strings, so you can translate UI copy, labels, or content batches in one request.

### How do I keep HTML or XML markup intact?

Set `tag_handling` to `html` or `xml`. The tags stay in place while the text inside them is translated.

### Can I control the tone of the translation?

Yes. Use the formality setting to bias the output toward formal or informal language, and add context when a word could mean more than one thing.

### How do I know which language codes are supported?

Use `list_languages` to see the supported source and target codes, then `detect_language` if you need to identify the input language before translating.

---

## Get Started with ToolRouter

**Already connected?** Call any tool with `use_tool({ tool, skill, input })`. Browse tools with `discover` or visit https://toolrouter.com/llms-full.txt

**New to ToolRouter?** Connect with one command (no API key needed — auto-provisions on first use):

```bash
# MCP (Claude Code, Codex CLI)
claude mcp add toolrouter -- npx -y toolrouter-mcp

# MCP (Cursor, Windsurf, Cline, VS Code, Gemini CLI, Claude Desktop)
{"mcpServers":{"toolrouter":{"command":"npx","args":["-y","toolrouter-mcp"]}}}

# Claude Chat / Claude Cowork / Claude Mobile — add as a connector:
# Settings → Connectors → Add custom connector → URL: https://api.toolrouter.com/mcp

# ChatGPT — add as an app:
# Settings → Apps → Advanced settings → enable Developer mode → Create app → MCP Server URL: https://api.toolrouter.com/mcp

# CLI (works instantly, no restart needed)
npx -y toolrouter-mcp tools                    # browse all tools
npx -y toolrouter-mcp search "seo"             # search by keyword
npx -y toolrouter-mcp call seo analyze_page --url https://example.com
```

Free tools work immediately. For paid tools, visit https://toolrouter.com/claim to add credits.

All platforms: https://toolrouter.com/connect | Full catalog: https://toolrouter.com/llms-full.txt | Docs: https://toolrouter.com/docs