GetLanguageNames Method

GetLanguageNames Method

Retrieves friendly names for the languages passed in as the parameter languageCodes, and localized using the passed locale language.

Request URI

URI parameters
Parameter Description


Required. A string containing "Bearer" + " " + access token.


Required. A string representing a combination of an ISO 639 two-letter lowercase culture code associated with a language and an ISO 3166 two-letter uppercase subculture code to localize the language names or a ISO 639 lowercase culture code by itself.


Required. A string array representing the ISO 639-1 language codes to retrieve the friendly name for.

Return value
A string array containing the friendly language names of the passed languageCodes.

Ff512399.alert_note(en-us,MSDN.10).gif Note

Bing App ID is deprecated and is no longer supported.   Please obtain an access token to use the Microsoft Translator API. For details, go here.


Obtain an Access Token on the server-side

public static AdmAccessToken GetAccessToken()
    AdmAccessToken admToken;
    string headerValue;
    //Get Client Id and Client Secret from
    AdmAuthentication admAuth = new AdmAuthentication("clientid", "clientsecret");

    admToken = admAuth.GetAccessToken();
    // Create a header with the access_token property of the returned token
    headerValue = "Bearer" + " " + HttpUtility.UrlEncode(admToken.access_token);

    return admToken;
Invoke the AJAX method on the client-side

<html xmlns="">
<head runat="server">
    <script type="text/javascript">
        var languageCodes = "[\"de\", \"fr\", \"it\"]";
        function getLanguageNames() {
            PageMethods.GetAccessToken(OnSucceeded, OnFailed);

        function OnSucceeded(result, usercontext, methodName) {

            window.mycallback = function (response) {
                var array = response;
                var languageNames = "";
                for (var i = 0; i < array.length; i++) {
                    languageNames = languageNames + array[i] + "\n";

            var s = document.createElement("script");
            s.src = " " + encodeURIComponent(result.access_token) + "&locale=en&languageCodes=" + languageCodes;
        function OnFailed(error, userContext, methodName) {
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager" runat="server" EnablePageMethods="true" />
        <asp:Button ID="buttonLangName" runat="server" Text="Get Language names" OnClientClick="getLanguageNames();return false;" />
© 2015 Microsoft