# i18n File Translator - JSON, YAML, PO, Strings & Android XML (`tidytools/i18n-file-translator`) Actor

Translate app localization files: JSON (i18next, ARB), YAML (Rails), gettext .po, iOS .strings and Android strings.xml. Keys, placeholders and HTML tags kept; same file format back plus a list of strings left untranslated. $1.50 per 1M characters.

- **URL**: https://apify.com/tidytools/i18n-file-translator.md
- **Developed by:** [Yukai Lin](https://apify.com/tidytools) (community)
- **Categories:** Developer tools, AI, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 1,000 source characters

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## i18n File Translator - JSON, YAML, PO, Strings & Android XML

### What does i18n File Translator do?

**Translate your app's localization files and get the same file back, ready to drop into your project.** Give links to (or paste) resource files and choose one or more languages. Only the text values are translated. Keys, structure, comments and placeholders are kept, and every string that could not be translated safely is listed.

- 📁 **Formats**: JSON (i18next, react-intl, vue-i18n, Flutter `.arb`, nested or flat), YAML (Rails, Symfony), gettext `.po` / `.pot`, Apple `.strings` (UTF-8 or UTF-16) and Android `strings.xml` (`<string>`, `<string-array>`, `<plurals>`).
- 🔒 **Placeholders are checked**: `%s`, `%1$s`, `%d`, `%@`, `{name}`, `{{name}}`, `%{name}`, `%(name)s`, ICU `{count, plural, ...}`, `$t(key)`, HTML tags, react-i18next `<1>…</1>`, Android `<xliff:g>` and links. When the AI changes one, the string is translated once more. If it is still wrong, **the original string is kept and listed under `untranslated`**: your file never ships a broken placeholder.
- 🧾 **Only values change.** JSON, PO, `.strings` and XML files are edited in place: key order, indentation, comments, line endings and untranslated values stay byte for byte. YAML keeps its comments and order.
- 🌍 **Locale follows the target**: a Rails root key `en:` becomes `es:`, ARB `@@locale` and the PO `Language:` header are updated.
- 💸 **$1.50 per 1 million characters** of text written translated. Links, placeholders-only values, broken placeholders, repeats within a file and failed files are free.

### How to use it

1. Put links in **Resource file links** (raw files, or GitHub / GitLab file pages), or paste one file into **Or paste one file**.
2. Set **Target language** (a name such as `Spanish` or a code such as `pt-BR`) and, optionally, **More target languages**.
3. Add your app and brand names to **Glossary** so they are never translated.
4. Run. Download each translated file from the `translatedFileUrl` column (it is also in the run's key-value store), and check the `untranslated` list.

Android: save the result as `res/values-<locale>/strings.xml` (for example `values-es`). Strings marked `translatable="false"` are not sent.

### Input example

```json
{
    "fileUrls": [
        "https://raw.githubusercontent.com/rails/rails/main/activemodel/lib/active_model/locale/en.yml",
        "https://github.com/android/sunflower/blob/main/app/src/main/res/values/strings.xml"
    ],
    "targetLanguage": "Spanish",
    "targetLanguages": ["Japanese"],
    "glossary": ["Sunflower"]
}
```

| Field | Meaning |
|---|---|
| `fileUrls` | Links to resource files, up to 100 per run (a pasted file counts as one) and 5 MB each. GitHub and GitLab file page links are read as the raw file. |
| `fileContent`, `fileName` | Or paste one file, up to 5 MB. The name (e.g. `strings.xml`, `en.yml`) tells the format and names the result. |
| `targetLanguage`, `targetLanguages` | Up to 20 languages in one run. Each file is read once; each language is billed separately. A name and its code in any case (`Spanish`, `es`, `ES`; `Brazilian Portuguese`, `pt-BR`, `PT-BR`, `Pt-br`) count as one language. |
| `format` | `auto` (default: from the file extension, then the content), `json`, `yaml`, `po`, `strings` or `android-xml`. |
| `glossary` | Terms to keep exactly as written, up to 200. |
| `tone` | `neutral` (default), `formal`, `casual`, `marketing` or `technical`. |
| `sourceLanguage` | Language of the original strings. Empty = detected automatically. |
| `engine` | `fast` (default) or `quality`. Same price. |
| `maxConcurrency` | Files translated at the same time, 1-10 (default 3). |

### Output example

One row per **file and target language**:

```json
{
    "inputIndex": 0,
    "sourceUrl": "https://raw.githubusercontent.com/rails/rails/main/activemodel/lib/active_model/locale/en.yml",
    "fileName": "en.yml",
    "format": "yaml",
    "targetLanguage": "Spanish",
    "targetLocale": "es",
    "success": true,
    "strings": 27,
    "stringsTranslated": 27,
    "stringsKept": 1,
    "untranslatedCount": 0,
    "untranslated": [],
    "sourceCharacters": 687,
    "translatedFileUrl": "https://api.apify.com/v2/key-value-stores/STORE_ID/records/en-es.yml",
    "translatedFileKey": "en-es.yml",
    "translatedFile": "es:\n  errors:\n    # The default format to use in full error messages.\n    format: \"%{attribute} %{message}\"\n    ...",
    "localeChange": { "field": "root key", "from": "en", "to": "es" },
    "engine": "fast",
    "charged": true,
    "errorType": null,
    "error": null,
    "translatedAt": "2026-11-06T12:00:00.000Z"
}
```

A string kept in the source language appears in `untranslated`, for example `{ "key": "count", "reason": "placeholder_changed", "issues": [{ "kind": "printf", "missing": ["%d"], "extra": [] }] }`.

| Field | Meaning |
|---|---|
| `inputIndex`, `sourceUrl`, `fileName` | Which file the row belongs to. |
| `format`, `targetLanguage`, `targetLocale` | Format read, the language asked for and its locale code (null when unknown). |
| `strings`, `stringsTranslated` | Values with text, and how many of them were written translated. |
| `stringsKept` | Values kept as they are without being sent: links, e-mail addresses, placeholders only, Android references and `translatable="false"`. |
| `untranslatedCount`, `untranslated` | Strings left in the source language (at most 500 listed): `key`, `reason` (`placeholder_changed`, `translation_failed`, `rewritten` or `too_long`) and, for placeholders, `issues`. |
| `sourceCharacters` | Characters billed for this row (each different string once). |
| `translatedFileUrl`, `translatedFileKey`, `translatedFile` | Link to the translated file, its key in the key-value store, and its content (up to 100,000 characters). |
| `localeChange` | The locale field that was changed (Rails root key, ARB `@@locale`, PO `Language:` header), or null. |
| `success`, `charged`, `errorType`, `error` | The file was written / this row was charged / why a row is free. |

Free rows use these `errorType` values: `invalid_input` (not a web address, a link with a broken `%` escape, not a language name, more than 100 files, a pasted file over 5 MB; these rows have `input` with the field and position, never the value you typed), `not_found`, `blocked` (the host refused), `too_large` (over 5 MB or over 20,000 different strings), `download_failed`, `timeout`, `unsupported` (a web page instead of a file, or a format that cannot be detected), `invalid_file` (the file is not valid JSON / YAML / PO / .strings / Android XML, with the line when known), `no_text` (only links or placeholders), `not_translated` (every string kept because placeholders changed), `translation_failed`, `save_failed` and `limit_reached` (your maximum charge per run was reached).

The **SUMMARY** record has `status`, `files`, `filesTranslated`, `failed`, `targetLanguages`, `strings`, `stringsTranslated`, `untranslated`, `placeholderRetries`, `sourceCharactersBilled`, `unitsCharged`, `invalidInputs`, `duplicatesSkipped` and `costPlan` (with `inputNotes`, `resumed` and `notProcessed` when they apply).

### Pricing

**$1.50 per 1,000,000 characters** ($0.0015 per 1,000) of source strings written translated, with the usual Apify plan discounts. Characters are added up over the run, so many short strings cost what their total length costs.

- **Free**: values kept as they are, strings left untranslated, a string repeated within a file after the first time, and every failed file or input above.
- Each target language is billed separately. A run stops before a file that would pass your **maximum charge per run** (free `limit_reached` row).

Examples: the Rails `activemodel` English file (687 characters) into Spanish = 1 unit, $0.0015. A 5,000-word app (about 30,000 characters) into 10 languages = about $0.45.

### Limitations

- **Machine translation (Llama models on Cloudflare Workers AI).** Review texts that matter, such as legal and payment screens. Short UI labels have no context, so the AI may choose a different word than your team would; use the glossary for fixed terms.
- **Plural forms are not added.** A PO file keeps its `msgstr[n]` entries and `Plural-Forms` header, and Android keeps its `<item quantity>` list. Languages with more plural forms (Polish, Russian, Arabic) need the extra forms added by hand. ICU messages may add or drop plural categories.
- `.stringsdict`, XLIFF, `.resx`, `.properties`, CSV and spreadsheets are not supported yet. YAML files are written back with normalized spacing, and multi-document YAML is not read.
- Existing PO translations are replaced: every entry is translated from its `msgid`.
- Up to 100 files per run (links plus the pasted file), 5 MB and 20,000 different strings per file, 8,000 characters per string.

### FAQ

**Are my keys or placeholders ever translated?** Keys never are. Placeholders and tags are compared after translation; a string where they changed is kept in the source language and listed.

**Why is a string under `untranslated`?** The `reason` says why: `placeholder_changed` (with the tokens that were lost or added), `translation_failed`, `rewritten` (the AI wrote new copy instead of a translation) or `too_long`. Those strings are free.

**Can I translate private repositories?** Paste the file into **Or paste one file**, or use a link that does not need a login.

**Can AI agents call it?** Yes: the input is plain JSON, and each row has a link to the translated file and the list of strings to review.

# Actor input Schema

## `fileUrls` (type: `array`):

Links to localization files: .json / .arb, .yml / .yaml, .po / .pot, .strings or Android strings.xml (up to 100 per run counting a pasted file, 5 MB each). GitHub and GitLab file page links are read as the raw file. A link that is not a web address becomes one free error row.

## `fileContent` (type: `string`):

The content of one resource file, up to 5 MB. Set "File name" or "Format" when the format is not clear from the content.

## `fileName` (type: `string`):

E.g. strings.xml or en.yml: tells the format and names the translated file.

## `targetLanguage` (type: `string`):

Language name or code, e.g. Spanish, Japanese, Traditional Chinese, pt-BR.

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

Translate into several languages in one run (up to 20). Each file is read once; each language is billed separately.

## `format` (type: `string`):

Usually detected from the file extension or content.

## `glossary` (type: `array`):

Brand, product and feature names to keep exactly as written, e.g. your app name. Up to 200 terms.

## `tone` (type: `string`):

Register of the translation. Formal is usual for business apps (German Sie, French vous).

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

Language of the original strings, e.g. English. Empty = detected automatically.

## `engine` (type: `string`):

Same price. Fast is recommended for Chinese, Japanese and Korean.

## `maxConcurrency` (type: `integer`):

How many files are translated in parallel.

## Actor input object example

```json
{
  "fileUrls": [
    "https://raw.githubusercontent.com/i18next/react-i18next/master/example/react/public/locales/en/translation.json"
  ],
  "targetLanguage": "Spanish",
  "format": "auto",
  "tone": "neutral",
  "engine": "fast",
  "maxConcurrency": 3
}
```

# Actor output Schema

## `files` (type: `string`):

No description

## `store` (type: `string`):

No description

## `summary` (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 = {
    "fileUrls": [
        "https://raw.githubusercontent.com/i18next/react-i18next/master/example/react/public/locales/en/translation.json"
    ],
    "targetLanguage": "Spanish"
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidytools/i18n-file-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 = {
    "fileUrls": ["https://raw.githubusercontent.com/i18next/react-i18next/master/example/react/public/locales/en/translation.json"],
    "targetLanguage": "Spanish",
}

# Run the Actor and wait for it to finish
run = client.actor("tidytools/i18n-file-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 '{
  "fileUrls": [
    "https://raw.githubusercontent.com/i18next/react-i18next/master/example/react/public/locales/en/translation.json"
  ],
  "targetLanguage": "Spanish"
}' |
apify call tidytools/i18n-file-translator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tidytools/i18n-file-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/W9EXmamVkLCtyYc5w/builds/cO3Y04oqLVZJl1iqB/openapi.json
