Google has released AJAX API for language detection and translation. The API helps developers automatically translate content in their applications. Users on these sites will have an easier time communicating across lingual boundaries. The Language API provides both translation and language detection.
The API works for the same language pairs that are available at Google Translate and lets you display the translation of a text inside your own page, without having to link to an external translation service.
The translation API could be used to automatically translate some content from a web page using the browser's preferred language, to create a Greasemonkey script that translates to English the posts written in other languages, to detect if a comment is written in English before posting it and for many other things.
For more information on how to use the Language API in your code, please refer to the documentation here.
Here's an example of the translation tool in action:
You can play around with the language detection capabilities via this example widget:
Google, Google Translate, Ajax, API, Language Translation, Translator