Plus plan

Translate a localization file

Translate an app or website text file and keep its structure intact
POST
/v1/ai/documents/localize

About this tool

This tool translates the wording inside a language file used by apps and websites (formats such as JSON, YAML, PO, XLIFF or ARB, which are just ways of storing a list of labels and messages). The labels on the left stay exactly as they are, placeholders like {name} are checked, and a file in the same format is rebuilt. An AI does the translating, so it can make mistakes.
For example, you have an English strings file for your mobile app and want a French version that your developer can use straight away.

How to use it

  1. Choose this tool.
  2. Add your language file with Upload or drag and drop (one file).
  3. Choose the language to translate into, and the original language if you know it.
  4. Optionally add a glossary, which is a list of words that must always be translated your way.
  5. Press Generate, then download the result.

What you get back

You get a new file in the same format as the one you added, with the text translated. You can download it.
TEST IT LIVE

Try Translate a localization file in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
AI
Plan
Plus
Method
POST
Endpoint
/v1/ai/documents/localize
Tool ID
ai.documents.localize
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Ai
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/ai/documents/localize" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'on_unsupported=error' \
  -F 'quality=standard' \
  -F 'target_language=xx'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.ai.documents.localize({
    "on_unsupported": "error",
    "quality": "standard",
    "target_language": "xx"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->ai()->documents()->localize([
    'on_unsupported' => 'error',
    'quality' => 'standard',
    'target_language' => 'xx',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Translate the strings of a JSON, YAML, PO, properties, XLIFF or ARB file: keys stay as they are, placeholders are checked, the glossary is applied and a file in the same format is rebuilt. Readiness: unbenchmarked (see GET /v1/ai/capabilities/documents.localize).

Classification: hybrid. Deterministic stages: file type detection from content, native PDF text extraction / OCR for documents, image normalisation (Sharp).

Translate a localization file works from text and settings, so no file is needed. The required inputs are target_language.

Not on the Free plan: Translate a localization file is available on the Plus plan and above. Free accounts can upgrade any time to use it. Each run uses credits from your monthly allowance.

Send a POST request to /v1/ai/documents/localize with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.