POST /translator/translate/yaml

Translate YAML

Translate YAML content while preserving keys, structure, and formatting.

Translation API

Translate YAML content while preserving all keys, nested structure, and formatting. String values are translated while non-string values remain unchanged. Ideal for localizing Rails i18n files, configuration files, and other YAML-based resources.

HTTP Request

1
POST /translator/translate/yaml

Parameters

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

Request Body

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
navigation:
  home: "Home"
  about: "About Us"
  contact: "Contact"
messages:
  greeting: "Welcome back!"
  logout: "You have been logged out successfully."
settings:
  max_items: 50
  debug: false

Response

1
2
3
4
5
6
7
8
{
  "status": true,
  "data": {
    "translated_yaml": "navigation:\n  home: \"Inicio\"\n  about: \"Sobre Nosotros\"\n  contact: \"Contacto\"\nmessages:\n  greeting: \"Bienvenido de nuevo!\"\n  logout: \"Ha cerrado sesion exitosamente.\"\nsettings:\n  max_items: 50\n  debug: false",
    "source_language": "en",
    "source_language_name": "English"
  }
}

Response Fields

FieldTypeDescription
statusbooleanWhether the request was successful
data.translated_yamlstringThe translated YAML content
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
import requests

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

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

payload = """navigation:
  home: "Home"
  about: "About Us"
  contact: "Contact"
messages:
  greeting: "Welcome back!"
  logout: "You have been logged out successfully."
"""

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_yaml"])
 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
const url = "https://multi-format-ai-translator-the-most-complete.p.rapidapi.com/translator/translate/yaml";

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

const yaml = `navigation:
  home: "Home"
  about: "About Us"
  contact: "Contact"
messages:
  greeting: "Welcome back!"`;

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: yaml,
});

const data = await response.json();
console.log(data.data.translated_yaml);
1
2
3
4
5
6
7
8
curl -X POST "https://multi-format-ai-translator-the-most-complete.p.rapidapi.com/translator/translate/yaml?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 'navigation:
  home: "Home"
  about: "About Us"
  contact: "Contact"'
Start building today

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

Get Your API Key on RapidAPI