AJAX
To start using the AJAX interface for the Microsoft Translator service all you need to do is to direct an ajax call to the appropriate http://api.microsofttranslator.com/V2/Ajax.svc method and register a callback function and that's it, the translator API will handle the heavy lifting and pass the results of the method back to a registered callback function and part of this heavy lifting is the encodeURIcomponent function which is provided to escape UTF characters that may be present in the strings that we pass to the translator service.
How this all works is to dynamically register a html script element to the <head> tag of the page via accessing the DOM. Within this script is contained the call to the translator ajax service API, as well as a callback function.
Once the AJAX call to the Microsoft Translator API is complete, the API will return to the callback handler function that we have previously nominated.
Public Methods
| Name | Description |
|---|---|
|
Adds a translation to the translation memory. | |
|
Adds an array of translations to the translation memory. | |
|
Returns an array of sentence lengths for each sentence of the given text. | |
|
Detects the language of a selection of text. | |
|
Detects the language of an array of strings. | |
|
Obtains a list of the languages supported by the Translator Service. | |
|
Obtains a list of the language codes supported by the Translator Service for speech synthesis. | |
|
Obtains a list of the language codes supported by the Translator Service. | |
|
Returns an array of alternative translations of the given text. | |
|
Returns an array of alternative translations of the passed array of text. | |
|
Returns a string with a URL to a wave stream of the passed in text in desired language. | |
|
Converts a text string from one language to another. | |
|
Translates an array of texts into another language. |