Translate.la API


Translate.la API provides programmatic access to translation examples in json and html formats.

Usage


Parameters


phrase: (required) the phrase must be included by the examples of the source(from) language. Infected forms are accepted. If you query for "walked away", you will get the all results for walk away, walking away, walked away, etc.

from/to: (required) Values: english, dutch, french, german, greek, italian, japanese, korean, polish, portuguese, romanian, russian, spanish, turkish. (Crossover queries are not supported. One of "from" or "to" must be "english".)

amount: (required, Max. 50) The number of the example sentences to be returned.

format: (required) Values: html, json

Example Html Output:


<div class="tapi-content">

<div class="tapi-row">
<div lang="en" class="tapi-source">
He walked away.
</div>
<div lang="it" class="tapi-translation">
È andato via.
</div>
</div>

<div class="tapi-row">
<div lang="en" class="tapi-source">
I waved good bye and then walked away.
</div>
<div lang="it" class="tapi-translation">
Salutai con la mano e poi me ne andai.
</div>
</div>

</div>


Implementation of Html Format



PHP


<?php
$url = file_get_contents('https://api.translate.la/tapi?phrase=thing&from=english&to=spanish&amount=10&format=html');
echo $url;
?>

Note for Wordpress users: If file_get_contents() is not enabled in php.ini, wp_remote_get() is the best option, will use cURL if available, if not, it find and uses any available HTTP transport.

ASP(VbScript)


<% Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
Call objXML.open("GET", "https://api.translate.la/tapi?phrase=thing&from=english&to=spanish&amount=10&format=html", False)
objXML.send()

Response.Write(objXML.responseText)
Set objXML = Nothing
%>

Styling


<style>
.tapi-content{line-height:20px;width:728px;padding:7px 0 7px}
.tapi-row{background:#f3f3f3;display:table;min-height:67px;width:100%;padding:4px 5px 3px 7px}
/* Side by side design */
.tapi-source{width:318px;vertical-align:middle;display:table-cell}
.tapi-translation{width:318px;margin-left:8px;padding-left:8px;vertical-align:middle;display:table-cell}
/* One under the other
.tapi-source{width:540px;padding-right:2px;margin-top:6px;vertical-align:middle;clear:both}
.tapi-translation{width:540px;margin-bottom:5px;margin-top:4px;vertical-align:middle;color:#777;clear:both;}
*/
.tapi-row:nth-of-type(odd){background:#fff}
</style>

Preview


Side by side design
One under the other

Terms of Service


Translate.la API is free of charge. However, It would be kind adding readable information or a link about the API provider. Please, contact us if you have any problem while implementing the API into your website.