Articles Tagged 'Google Translate'

Google AJAX Language API and prototype.js

After seeing the operation of the Google AJAX APIs I came up with an alternative way to translate Web pages leveraging our real-time prototype.js , you can mark the HTML tags we want to translate, instead of subjecting the entire document to translation. : To mark the HTML tags I used to translate the attribute rel , setting it to translate :

1
"translate" > Questo testo deve essere tradotto < / p > < p rel = "translate"> This text should be translated </ p >

With a simple function, then we can use prototype.js to process all HTML tags with rel='translate' :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/ **
* @ Name: translate ()
* @ Description: translate
* /
function translate () {
) . each ( $ $ ('[Rel = "translate"]'). Each (
e ) { function (s) {
( e. innerHTML , 'it' , 'en' , google. language. translate (e. innerHTML, 'en', 'en',
result ) { function (result) {
result. translation ) { if (result. translation) {
result. translation ; e. innerHTML = result. translation;
{ Else {}
'Translate Error! \n \n ' + result. error . message ) ; alert ('Error Translate \ n \ n' + result. error. message);
}
}
);
}
);
}

You can see this in action on e-lementi.com

Of course the script can (and / or must) be completed as appropriate. . It is interesting to note, however, that it is possible to specialize in order to replace the images (in the case of graphical buttons that contain text), or develop him as a special TAG INPUT or TEXTAREA .

One of the limitations that I encountered, and I would like to deepen, the number of characters that can be translated. In case of important texts, in fact, it is not difficult to get an error: that in fact I run the script with an alert() .

Continued ...

Google AJAX Language API tutorial on the operation

I respond with this post, at the request of Andrea on how to insert the translator of Google in your web. There are several ways to take advantage of machine translation services available from Google and beyond. We can use plugins written by others, a simple JavaScript script from Google itself or mixed learning to use the API, ie a set of callable functions - as we shall see - in various ways.

Plugins

I will not dwell on this solution, as I think is not really relevant to the request of Andrew , if I understood well. Furthermore, it is essentially a solution valid only for the blog and not to use custom and generic. I can only point out to users by WordPress , Global Translator , perhaps the most simple, practical and popular plugins of this type.

Pre script by Google

The easiest way to translate your website or your blog is to add a simple JavaScript script provided by Google. Just go to the site translate.google.com tab and click on 'Tools'. From this page you can preset the translation functions or leave the default. The script is very simple:

1

and as a result we obtain:

Google Translate

Continued ...

Google Translate is updated

Just a few days ago I wrote a post on machine translation , addressing the issue of sites and / or multi-language blog from my point of view of the developer. I have received, in fact, some interesting comments that highlight the limits of current technologies. In fact, systems that allow you to translate "on the fly" our Web pages, like Google Translate , absolutely do not produce results comparable to that of humans, who - in short - of craft works as a translator. In addition there is a specialization of these public systems: translating a scientific text in English and a novel to be translated differently in English or a manual computer and so on. This, with a translation of "human" we know that does not happen and are just professionist translators who specialize in very specific areas.

However, as I said (in private email being the full-bodied) to Leonardo , there are cases in which an automatic translator, especially with the advent of the blog, allows you to reduce time and cost, allowing, within the limits of current machine translation systems, at least in their own language to understand what is written on the Web

image Just recently Google Translate has updated its online translation system, adding support for many, if not all, of the languages ​​of the world: from China to the Japanese and many other greek. The interface has been renewed proponedo pull-down menus to make it easier to choose the source language and the "translation".

Continued ...


Stop SOPA