POST /translator/translate/toml

Translate TOML

Translate TOML configuration content while preserving structure, keys, and data types.

Translation API

Translate TOML configuration content while preserving document structure, keys, tables, and non-string data types. Only string values are translated, keeping your configuration layout and numeric/boolean values intact. Ideal for localizing Rust Cargo files, Python pyproject.toml, and other TOML-based configurations.

HTTP Request

1
POST /translator/translate/toml

Parameters

ParameterTypeRequiredDefaultDescription
sourcestringNo"auto"Source language code. Use auto for automatic detection
targetstringYesTarget language code

Request Body

Send the TOML content as the raw request body with Content-Type: text/plain.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[metadata]
title = "Getting Started Guide"
description = "A comprehensive guide to help you get started with our platform"
version = "1.0.0"

[messages]
welcome = "Welcome to our application"
goodbye = "Thank you for using our service"
error = "Something went wrong. Please try again later."

[labels]
submit = "Submit"
cancel = "Cancel"
next = "Next Step"

Response

1
2
3
4
5
6
7
8
{
  "status": true,
  "data": {
    "translated_toml": "[metadata]\ntitle = \"Guia de Inicio\"\ndescription = \"Una guia completa para ayudarte a comenzar con nuestra plataforma\"\nversion = \"1.0.0\"\n\n[messages]\nwelcome = \"Bienvenido a nuestra aplicacion\"\ngoodbye = \"Gracias por usar nuestro servicio\"\nerror = \"Algo salio mal. Por favor intentalo de nuevo mas tarde.\"\n\n[labels]\nsubmit = \"Enviar\"\ncancel = \"Cancelar\"\nnext = \"Siguiente Paso\"",
    "source_language": "en",
    "source_language_name": "English"
  }
}

Response Fields

FieldTypeDescription
statusbooleanWhether the request was successful
data.translated_tomlstringThe translated TOML content with structure preserved
data.source_languagestringDetected or specified source language code
data.source_language_namestringHuman-readable name of the source language

Code Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import requests

url = "https://multi-format-ai-translator-the-most-complete.p.rapidapi.com/translator/translate/toml"

querystring = {
    "source": "auto",
    "target": "es"
}

payload = """[metadata]
title = "Getting Started Guide"
description = "A comprehensive guide to help you get started with our platform"

[messages]
welcome = "Welcome to our application"
goodbye = "Thank you for using our service"
error = "Something went wrong. Please try again later."

[labels]
submit = "Submit"
cancel = "Cancel"
next = "Next Step"
"""

headers = {
    "Content-Type": "text/plain",
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "multi-format-ai-translator-the-most-complete.p.rapidapi.com"
}

response = requests.post(url, headers=headers, params=querystring, data=payload)
data = response.json()

print(data["data"]["translated_toml"])
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const url = "https://multi-format-ai-translator-the-most-complete.p.rapidapi.com/translator/translate/toml";

const params = new URLSearchParams({
  source: "auto",
  target: "es",
});

const toml = `[metadata]
title = "Getting Started Guide"
description = "A comprehensive guide to help you get started with our platform"

[messages]
welcome = "Welcome to our application"
goodbye = "Thank you for using our service"
error = "Something went wrong. Please try again later."

[labels]
submit = "Submit"
cancel = "Cancel"
next = "Next Step"`;

const response = await fetch(`${url}?${params}`, {
  method: "POST",
  headers: {
    "Content-Type": "text/plain",
    "X-RapidAPI-Key": "YOUR_API_KEY",
    "X-RapidAPI-Host": "multi-format-ai-translator-the-most-complete.p.rapidapi.com",
  },
  body: toml,
});

const data = await response.json();
console.log(data.data.translated_toml);
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
curl -X POST "https://multi-format-ai-translator-the-most-complete.p.rapidapi.com/translator/translate/toml?source=auto&target=es" \
  -H "Content-Type: text/plain" \
  -H "X-RapidAPI-Key: YOUR_API_KEY" \
  -H "X-RapidAPI-Host: multi-format-ai-translator-the-most-complete.p.rapidapi.com" \
  -d '[metadata]
title = "Getting Started Guide"
description = "A comprehensive guide"

[messages]
welcome = "Welcome to our application"
goodbye = "Thank you for using our service"'
Start building today

Get your API key and make your first request in under a minute.

Get Your API Key on RapidAPI