TranslatorLibrary.GetLanguagesAsync() Method

Bing
 

The GetLanguagesAsync() method retrieves the list of languages codes that Translator can translate from or into.

Published date: October 21, 2013

public IAsyncAction GetLanguagesAsync()

Type: Bing.Translator.GetLanguagesResult

Description: The language codes supported by the Translator Services and a Result Code.

The GetLanguagesAsync() method retrieves the list of language codes representing languages that are supported by the Translation Service. Use the TranslateAsync() method to translate between any of these languages.

Example

The following example retrieves the languages codes that the TranslatorControl can translate from and to.

// Initialize a TranslatorLibrary instance.
var translatorApi = Bing.Translator.TranslatorLibrary("CLIENTID", "CLIENTSECRET");

// Get the list of language codes and write them to a UI element with an ID of 'languages'.
translatorApi.getLanguagesAsync().then(function (result) {
    document.getElementById('languages').innerText = result.languages;
});

Requirements

Minimum Supported Client

Windows 8.1

Required Extensions

Bing Translator Control

Namespace

Bing.Translator

Show: