Export (0) Print
Expand All
2152 out of 2644 rated this helpful - Rate this topic

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

Microsoft.Translator.AddTranslation Method

Adds a translation to the translation memory.

Microsoft.Translator.AddTranslationArray Method

Adds an array of translations to the translation memory.

Microsoft.Translator.BreakSentences Method

Returns an array of sentence lengths for each sentence of the given text.

Microsoft.Translator.Detect Method

Detects the language of a selection of text.

Microsoft.Translator.DetectArray Method

Detects the language of an array of strings.

Microsoft.Translator.GetLanguageNames Method

Obtains a list of the languages supported by the Translator Service.

Microsoft.Translator.GetLanguagesForSpeak Method

Obtains a list of the language codes supported by the Translator Service for speech synthesis.

Microsoft.Translator.GetLanguagesForTranslate Method

Obtains a list of the language codes supported by the Translator Service.

Microsoft.Translator.GetTranslations Method

Returns an array of alternative translations of the given text.

Microsoft.Translator.GetTranslationsArray Method

Returns an array of alternative translations of the passed array of text.

Microsoft.Translator.Speak Method

Returns a string with a URL to a wave stream of the passed in text in desired language.

Microsoft.Translator.Translate Method

Converts a text string from one language to another.

Microsoft.Translator.TranslateArray Method

Translates an array of texts into another language.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.