With the AJAX Language API, you can translate and detect the language of blocks of text within a web page using JavaScript.
The API is new, so there might be some issues and slightly less than perfect documentation. Bear with us as we fill in the holes, and join the AJAX APIs developer forum to give feedback and discuss the API.
Table of Contents
Audience
This documentation is designed for people familiar with JavaScript programming and object-oriented programming concepts. There are many JavaScript tutorials available on the Web.Introduction
The "Hello, World" of the Google AJAX Language API
The easiest way to start learning about this API is to see a simple example. The following example detects the language of the given text and then translates it to English.You can view this example here or edit and play around with a similar example in the Code Playground.id="text">??????????id="translation">
Including the AJAX Language API on Your Page
To include the AJAX Language API in your page, utilize the Google AJAX API loader. The common loader allows you to load all of the AJAX APIs that you need, including the language API. You need to include both the Google AJAX APIs script tag and callgoogle.load("language", "1")
:
The first script tag loads the google.load
function, which lets you load individual Google APIs. google.load("language", "1")
loads Version 1 of the Language API. Currently, the AJAX Language API is in Version 1, but new versions may be available in the future. See the versioning discussion below for more information.
0 comments:
Post a Comment