Translate text with context awareness
curl --request POST \
--url https://api.lingopal.ai/v1/translate/translate-text-with-context \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'X-API-Key: <api-key>' \
--data 'text=<string>' \
--data 'context=<string>' \
--data 'source_language=<string>' \
--data target_language=en-USimport requests
url = "https://api.lingopal.ai/v1/translate/translate-text-with-context"
payload = {
"text": "<string>",
"context": "<string>",
"source_language": "<string>",
"target_language": "en-US"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
text: '<string>',
context: '<string>',
source_language: '<string>',
target_language: 'en-US'
})
};
fetch('https://api.lingopal.ai/v1/translate/translate-text-with-context', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lingopal.ai/v1/translate/translate-text-with-context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "text=%3Cstring%3E&context=%3Cstring%3E&source_language=%3Cstring%3E&target_language=en-US",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lingopal.ai/v1/translate/translate-text-with-context"
payload := strings.NewReader("text=%3Cstring%3E&context=%3Cstring%3E&source_language=%3Cstring%3E&target_language=en-US")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lingopal.ai/v1/translate/translate-text-with-context")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("text=%3Cstring%3E&context=%3Cstring%3E&source_language=%3Cstring%3E&target_language=en-US")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lingopal.ai/v1/translate/translate-text-with-context")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "text=%3Cstring%3E&context=%3Cstring%3E&source_language=%3Cstring%3E&target_language=en-US"
response = http.request(request)
puts response.read_body"<string>"{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Text
Translate text with context awareness
POST
/
v1
/
translate
/
translate-text-with-context
Translate text with context awareness
curl --request POST \
--url https://api.lingopal.ai/v1/translate/translate-text-with-context \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'X-API-Key: <api-key>' \
--data 'text=<string>' \
--data 'context=<string>' \
--data 'source_language=<string>' \
--data target_language=en-USimport requests
url = "https://api.lingopal.ai/v1/translate/translate-text-with-context"
payload = {
"text": "<string>",
"context": "<string>",
"source_language": "<string>",
"target_language": "en-US"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
text: '<string>',
context: '<string>',
source_language: '<string>',
target_language: 'en-US'
})
};
fetch('https://api.lingopal.ai/v1/translate/translate-text-with-context', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lingopal.ai/v1/translate/translate-text-with-context",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "text=%3Cstring%3E&context=%3Cstring%3E&source_language=%3Cstring%3E&target_language=en-US",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lingopal.ai/v1/translate/translate-text-with-context"
payload := strings.NewReader("text=%3Cstring%3E&context=%3Cstring%3E&source_language=%3Cstring%3E&target_language=en-US")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lingopal.ai/v1/translate/translate-text-with-context")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("text=%3Cstring%3E&context=%3Cstring%3E&source_language=%3Cstring%3E&target_language=en-US")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lingopal.ai/v1/translate/translate-text-with-context")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "text=%3Cstring%3E&context=%3Cstring%3E&source_language=%3Cstring%3E&target_language=en-US"
response = http.request(request)
puts response.read_body"<string>"{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Description
Translate text with context awareness using advanced AI translation services that understand the context and meaning of the content.โI