Friday, March 21st, 2008

Google AJAX Translation API

Category: Google, JavaScript, Library

<>p>Translation API

The game above uses the new Google AJAX Translation API that allows you to do two things via a simple JavaScript API.

Translation

If you want to take a word in one language, and translate it to another, you simply call something like this:

javascript
< view plain text >
  1. google.language.translate('Gato', 'es', 'en', function(result) {
  2.   alert(result.translation);
  3. });

Here are the languages we support.

What if you need to programatically grok which language a string is written in? You can use the detection algorythm:

javascript
< view plain text >
  1. google.language.detect('Questa linea di rilevare che questa è la lingua.',
  2.  function(result) {
  3.   alert(result.language);
  4. });

The detector doesn’t just tell you the result, it also lets you know how reliable and confident it is.

Related Content:

  • Google releases API for mashups
    Google Ajax Feed API released today is designed to help mashup developers more easily integrate RSS and Atom feeds into their applications. "Today, if...
  • Translate - Top Ten Android Apps
  • Bungee jumps into Ajax
    Bungee Labs today announced Bungee Connect, which is designed to reduce Web state management programming by "automating Ajax interactivity, providing...
  • Ajax Learning Guide
    Are you a Web developer? The time has come to rethink your entire approach to developing Web applications. Find out about the Ajax approach...
  • Ajax Learning Guide
    Are you a Web developer? The time has come to rethink your entire approach to developing Web applications. Find out about the Ajax approach...

Posted by Dion Almaer at 1:15 pm
16 Comments

++++-
4 rating from 44 votes

16 Comments »

Comments feed TrackBack URI

This is awesome!

Comment by leftist — March 21, 2008

Naaaaais! Now for the optional translational-correction api so that we can all improve their services. EN => DUT translation *SUCKS* big time!

Comment by SchizoDuckie — March 21, 2008

I’m interested in trying out the performance for entire pages, such that I can let a user select a language on screen, and the content is automatically translated.

Comment by Cory — March 21, 2008

For English-Russian translations, the demo above provides strange results: words are translated mostly correctly but some of them appear in the wrong case (genitive instead of nominative, which are spelled differently in Russian), and some have their first letter capitalized for no obvious reason.

Comment by ingdir — March 21, 2008

I played that 138 times… it’s addicting!

Comment by MadeByChad — March 21, 2008

@Cory, there is a script here to make arbitrary html elements translatable.

Comment by minimalmedia — March 22, 2008

I wish there is support for Urdu as well.

By the way, is there anyway to detect whether the language is RTL or not?

Comment by kadnan — March 22, 2008

@minimalmedia — very nicely done, except for one thing: you’re not caching the source text. If I click, say, “es” to translate a paragraph to Spanish, then click “en” to go back to English, instead of restoring the original English text, it translates to Spanish translation back into English, introducing translation artifacts. Eg. “Put to work on his own blog, or better yet, somehow better” instead of the original, “Put it to work on your own blog, or better yet, improve it somehow.”

Comment by michaelhart — March 22, 2008

Err, “translates the”, not “translates to”. My own writing sounds like it was run through Google translation too many times…

Comment by michaelhart — March 22, 2008

Wonderful! I’ve updated my previously-server-side app to fully JS. Tryanslator is probably the least fuss, user-friendly translation service :-)

Comment by choonkeat — March 23, 2008

Отличная новость. я уже первый обзор для рунета написал, с работающим примером. Оригинал здесь: http://abrdev.com/?p=286

Comment by aleksraiden — March 23, 2008

Of couse, the Google API have limitation – only up to 500 char are translated at onse, but no limit to translate request’s from one site/page

Comment by aleksraiden — March 23, 2008

Nice, now if only the google toolbar spellchecker would be available as a good API…

Comment by Afraithe — March 24, 2008

There seems to be indeed a limit on the text chunks that can be translated. We’ve implemented the new API for MapSkip and we simply break the text into paragraphs and run those through the API individually.

From our experiments, the limit seems to be roughly 1400 characters.

Comment by ThomasSturm — April 1, 2008

Languages with different word order like Japanese will never be accurate using this method. If you want to learn almost any language in the world so you can understand them properly, my site helps you to do it the easy way.
http://www.google.co.jp/search?q=cutout+japanese+english+cutouttranslations&btnG=%E6%A4%9C%E7%B4%A2&hl=ja&lr=lang_ja&client=firefox-a&rls=org.mozilla%3Aja%3Aofficial&hs=k5L

Comment by cutouttranslations — May 18, 2008

Nice one thanks for posting this. Such a simple implimentation for language translation. All we need now is for the mechanical translation to improve but i’m sure google is working on that.

Comment by Translator — June 5, 2009

Leave a comment

You must be logged in to post a comment.