This blog translated into other languages

Imagen de la traduccion de Inicios al arabe

As some of our visitors don’t understand Spanish (thanks for appreciate our pictures that much ;)), I’ve put some useful links in the first column to automatically translate the blog contents. Right now there are direct links to English, Arab, German, French, Italian, and Portuguese translations. I guess the later will provide fairly good results, since there are pretty similar languages. I hope results for English, Arab, and German will be at least good enough to have a taste of what’s going on.

I also wanted to take the chance to welcome those visitors who are coming these days from the French newspaper Libération. I have good friends in the French blogosphere and it’s always a very nice surprise when the net is more flexible than the -old?- political and cultural borders.

If you also have a blog, you may be wondering right now where all this magic comes from. The thing is that it’s very easy to provide machine translations of your website. You just need to add the following code to your sidebar:

<?php
$url = $_SERVER["PHP_SELF"];
if ( $_SERVER['QUERY_STRING'] <> '') {
$url .= "?" . $_SERVER['QUERY_STRING'];
}
$url = 'http://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
$url = str_replace(":", "%3A", $url);
$url = str_replace("/", "%2F", $url);
$url = str_replace("&", "%26", $url);
echo '<a lang="en" xml:lang="en" href="http://www.google.com/translate?hl=en&ie=UTF8&langpair=es%7Cen&u='.$url.'" rel="nofollow">English</a> | <a lang="ar" xml:lang="ar" title="Araby" href="http://www.google.com/translate?hl=en&ie=UTF8&langpair=es%7Car&u='.$url.'" rel="nofollow">العربية</a> | <a lang="de" xml:lang="de" href="http://www.google.com/translate?hl=en&ie=UTF8&langpair=es%7Cde&u='.$url.'" rel="nofollow">Deutsch</a> | <a lang="fr" xml:lang="fr" href="http://www.google.com/translate?hl=en&ie=UTF8&langpair=es%7Cfr&u='.$url.'" rel="nofollow">Français</a> | <a lang="it" xml:lang="it" href="http://www.google.com/translate?hl=en&ie=UTF8&langpair=es%7Cit&u='.$url.'" rel="nofollow">Italiano</a> | <a lang="pt" xml:lang="pt" href="http://www.google.com/translate?hl=en&ie=UTF8&langpair=es%7Cpt&u='.$url.'" rel="nofollow">Português</a>';
?>

It should be straightforward for those who are familiar with PHP. A brief explanation for those who don’t: the first part ($url=…) is for registering the address of the website you want to translate (the one you’re visiting). The second part (echo ‘…) sends the address to a free translation service (google in this case) including the source and target languages. It should work if your server has PHP installed (most of the applications in Internet, including WordPress, are written in PHP), .

0

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.