# Text Translator: bulk translation in 100 languages (`examsens.ai/text-translator`) Actor

Translates lists of text or plain text files between 100 languages, into several target languages at once, with language detection. Meta's M2M100 model runs inside the actor; no outside translation service is called.

- **URL**: https://apify.com/examsens.ai/text-translator.md
- **Developed by:** [Ed Rayyis](https://apify.com/examsens.ai) (community)
- **Categories:** AI
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 1,000 characters translateds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Text Translator: bulk translation in 100 languages

Give it a list of texts, or links to plain text files, pick one or more target languages, and it returns every text translated into each of them. The source language can be detected for each text.

Translation runs inside the actor with Meta's M2M100 models, released under the MIT License \[1]. No outside translation service is called and no API key is needed.

### Languages

The models translate directly between any two of 100 languages \[1], including English, Spanish, French, German, Italian, Portuguese, Dutch, Polish, Russian, Ukrainian, Turkish, Arabic, Hebrew, Hindi, Bengali, Chinese, Japanese, Korean, Vietnamese, Thai and Indonesian. The full list is in the language pickers.

### Input

- Texts: each one up to 100,000 characters. Line breaks are kept.
- Plain text file URLs: `.txt` links up to 5 MB, each translated as one text
- Source language: a language, or detect it for each text from its first 2,000 characters
- Target languages: one or more
- Model: `large` (the m2m100_1.2B model, default) or `standard` (the m2m100_418M model, faster and less accurate)
- Search: `better` (beam search, default) or `faster` (greedy)

### Output

Dataset: one item per text and target language with `index`, `source` (`input` or the file link), `ok`, `sourceLanguage`, `detectedLanguage`, `targetLanguage`, `model`, `characters`, `sourceText`, `translatedText` and `charactersCharged`. When the target is the source language, the text comes back unchanged with a `note`. A text that cannot be translated gets `ok: false` and an `error`, and the run carries on.

### Tested

- English, French and Japanese sentences into Spanish, German and English with both models, and into Japanese with the large model
- English into French, German, Spanish, Japanese, Chinese and Arabic with both models
- Language detection on English, Spanish, German, Japanese, Chinese and Arabic sentences
- An RFC text file (3,207 characters) into Spanish, and a two paragraph story file
- Greedy search with a set source language
- Errors: an empty text, a web page link
- The maximum charge: texts it does not cover are left unprocessed

The translations are machine made. In testing, the large model read better than the standard one, and both made mistakes: one Japanese translation reversed cause and effect. Review translations before you publish them.

### Speed

On 4 GB of memory, the large model translated the 3,207 character RFC file into Spanish in a 50 second run, model loading included.

### Pricing

Pay per event: one event per started 1,000 characters of each text, for each target language. A 1,500 character text into three languages is six events. Rows where the target is the source language are not charged, and neither are texts that fail. A text is left unprocessed, with an error saying so, when the maximum charge you set does not cover it. Once the maximum charge is reached, the run stops and writes no rows for the texts after it.

### Scope and conduct

Only the texts and links you supply are read.

### Support

Questions and problems: the Issues tab on this page.

### References

1. facebook/m2m100_1.2B · Hugging Face | Model card | huggingface.co. https://huggingface.co/facebook/m2m100_1.2B

# Actor input Schema

## `texts` (type: `array`):

Each text is translated on its own, up to 100,000 characters. Line breaks are kept.

## `textFileUrls` (type: `array`):

Links to plain text (.txt) files, up to 5 MB each. Each file is translated as one text.

## `sourceLanguage` (type: `string`):

Language of the texts. Detection looks at the first 2,000 characters of each text.

## `targetLanguages` (type: `array`):

Every text is translated into each language you pick. One dataset item per text and language.

## `model` (type: `string`):

Large gives better translations and takes about twice as long.

## `quality` (type: `string`):

Beam search compares several candidate translations; greedy takes the first.

## Actor input object example

```json
{
  "texts": [
    "The meeting has been moved to Thursday afternoon.",
    "Please return the signed contract by the end of the week."
  ],
  "sourceLanguage": "auto",
  "targetLanguages": [
    "es",
    "fr"
  ],
  "model": "large",
  "quality": "better"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "texts": [
        "The meeting has been moved to Thursday afternoon.",
        "Please return the signed contract by the end of the week."
    ],
    "targetLanguages": [
        "es",
        "fr"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("examsens.ai/text-translator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "texts": [
        "The meeting has been moved to Thursday afternoon.",
        "Please return the signed contract by the end of the week.",
    ],
    "targetLanguages": [
        "es",
        "fr",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("examsens.ai/text-translator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "texts": [
    "The meeting has been moved to Thursday afternoon.",
    "Please return the signed contract by the end of the week."
  ],
  "targetLanguages": [
    "es",
    "fr"
  ]
}' |
apify call examsens.ai/text-translator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,examsens.ai/text-translator"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/9QnIZSANhq04UHgyi/builds/afITTYaq9XYdN5E4o/openapi.json
