This page is dedicated to all developers that would like to help us develop the service, create new tools or integrate it in the existing software.
Open-Tran.eu has been providing an API since its inception in February, 2007. This section tries to describe the fundamental concepts and illustrate them with an example.
Whenever translation suggestions are requested, the server prepares the result as a set of objects. These objects are then either rendered in HTML (if the request came from user's browser) or serialized into JSON or XML. However they wouldn't be sent, every suggestion in the list have the same set of fields described below.
Every project within Open-Tran is identified with a single-letter code. Furthermore, Open-Tran hosts the icons used to identify the projects. Below is a table of the projects and their codes and icons.
| Code | Name | Icon |
|---|---|---|
| A | Mandriva | /images/mandriva-logo.png |
| D | Debian Installer | /images/debian-logo.png |
| F | Cor Jousma | /images/pompelyts.png |
| G | GNOME | /images/gnome-logo.png |
| I | Inkscape | /images/inkscape-logo.png |
| K | KDE | /images/kde-logo.png |
| M | Mozilla | /images/mozilla-logo.png |
| O | OpenOffice.org | /images/oo-logo.png |
| R | Fedora | /images/fedora-logo.png |
| S | openSUSE | /images/suse-logo.png |
| X | XFCE | /images/xfce-logo.png |
Notice that some of the logos might be copyrighted and their use might be restricted. Open-Tran hosts them in order to make sure that they are always available from the same location and in order to avoid so-called hot-linking.
As an example, consider the excerpt of the results from
http://en.es.open-tran.eu/suggest/file:

Notice, that different spellings of the word archivo are
separated from each other. Every distinctive spelling is a separate
suggestion. So let us first dive into the marked suggestions:
You can fetch the suggestions in the JSON format by requesting the results from a URL in the format exemplified here:
http://en.es.open-tran.eu/json/suggest/file
The above URL requests that the server provides suggestions of translations of the word file from English into Spanish. In response, the server sends a list with the suggestions. Every suggestion is an object described in the documentation of the XML-RPC calls. You may also refer to a commented excerpt of an output for the request http://en.id.open-tran.eu/json/suggest/save as.
Additionally, you can fetch a list of all supported language codes by requesting the URL:
http://open-tran.eu/json/supported
The interface is exported through the XML-RPC protocol. You can fetch the suggestions from the server using your own software by sending a request to the server and fetching an XML response with the results. The following link will take you to the documentation of all exported functions. An example response from the server (for the execution of suggest("save as", "pl") is here: save_as.xml.
Below is the list of programming languages with code snippets (or links to such) that give an example of how to access the Open-Tran service with it.
Below is an example of a very simple python script that searches for translations of the phrase "save as" from English to Brazilian Portugese.
from xmlrpclib import ServerProxy
lang = "pt_br" # replace with your language code
server = ServerProxy("http://open-tran.eu/RPC2")
for sugg in server.suggest("save as", lang):
print sugg
Ignacio Casal Quinteiro contributed an example implementation in C.
Yves Savourel contributed an example implementation in Java.
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
public void queryOpenTran (String textToQuery,
String sourceLanguage,
String targetLanguage)
{
try {
// Setup the XML-RPC client
XmlRpcClient client;
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL("http://open-tran.eu/RPC2"));
client = new XmlRpcClient();
client.setConfig(config);
// Prepare the query parameters
Object[] params = new Object[] {
new String(textToQuery),
new String(sourceLanguage),
new String(targetLanguage)};
// Execute the query
Object[] results = (Object[])client.execute("suggest2", params);
// Parse the result back
StringBuilder tmp = new StringBuilder();
for ( Object obj1 : results ) {
tmp.setLength(0);
Map map1 = (Map)obj1;
tmp.append(String.format("Translation=\"%s\"", (String)map1.get("text")));
tmp.append(String.format(", value=%d", (Integer)map1.get("value")));
tmp.append(String.format(", count=%d", (Integer)map1.get("count")));
Object[] projects = (Object[])map1.get("projects");
for ( Object obj2 : projects ) {
Map map2 = (Map)obj2;
tmp.append(String.format("\nProject: name=", (String)map2.get("name")));
tmp.append(String.format("\n original=\"%s\"", (String)map2.get("orig_phrase")));
tmp.append(String.format("\n flags=%d", (Integer)map2.get("flags")));
tmp.append(String.format("\n path=%s", (String)map2.get("path")));
tmp.append(String.format("\n count=%d", (Integer)map2.get("count")));
}
System.out.println(tmp.toString());
}
}
catch ( Throwable e ) {
e.printStackTrace();
}
}
Since June, 2008 it is possible to use the Open-Tran service in an off-line mode. Once the user downloads the databases, she may query it localy. The off-line access has one important advantage: it returns the results almost instantly.
First, go to our FTP site at ftp://open-tran.eu and download two databases: an English one (currently: ftp://open-tran.eu/ten-en.db) and one for your language (for example: ftp://open-tran.eu/ten-pt_br.db for Brazilian Portuguese). The databases have to be stored (or symlinked) in the .open-tran directory in the user's home directory.
You will also need to download the software from ftp://open-tran.eu/open-tran-latest.tar.gz. Currently, there are two tools in the tarball:
Open-Tran stores the phrases
in SQLite3 databases. Below is the
diagram depicting the current database schema. You can find the SQL
for it
in
the repository.

The field length in the table Phrases holds
the number of words in the phrase and there is currently only
one flag: value 1 indicates that the translation is fuzzy.
Open-Tran first tries to find the most similar phrase in the original language. In order to do that, we compute the number of words that are not in the intersection of the phrases. The lower the number, the better. As an example consider the following situation: we are looking for the phrase "do you really want to save". Let's consider the following candidates:
| candidate | score |
|---|---|
| do you really want to quit | 2 (quit, save) |
| save what you want | 3 (what, do, really) |
Once we find the best matches, we locate their translations via their locationid.