Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

AddTranslation Method

Adds a translation to the translation memory.

Request URI

URI parameters
Parameter Description

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


Required. A string containing the text to translate from. The string has a maximum length of 1000 characters.


Required. A string containing translated text in the target language. The string has a maximum length of 2000 characters.


Required. A string containing the language code of the source language. Must be a valid culture name.


Required. A string containing the language code of the target language. Must be a valid culture name.


Optional. An int representing the quality rating for this string. Value between -10 and 10. Defaults to 1.


Optional. The format of the text being translated. The supported formats are "text/plain" and "text/html". Any HTML needs to be well-formed.


Optional. A string containing the category (domain) of the translation. Defaults to "general".


Required. A string used to track the originator of the submission.


Optional. A string containing the content location of this translation.

Ff512393.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 https://datamarket.azure.com/developer/applications/
    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="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script type="text/javascript">
        var originalText = encodeURIComponent("una importante contribución a la rentabilidad de la empresa.");
        var translatedText = encodeURIComponent("an important contribution to the company profitability.");
        function addTranslation() {
            PageMethods.GetAccessToken(OnSucceeded, OnFailed);
        function OnSucceeded(result, usercontext, methodName) {

            var s = document.createElement("script");
            s.src = "http://api.microsofttranslator.com/V2/Ajax.svc/AddTranslation?appId=Bearer " + encodeURIComponent(result.access_token) + "&originalText="
            + originalText + "&translatedText=" + translatedText + "&from=es&to=en&user=TestUserId";
            alert("Translation have been submitted.");

        function OnFailed(error, userContext, methodName) {
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager" runat="server" EnablePageMethods="true" />
        <br />
        <asp:Button ID="buttonAddTrans" runat="server" Text="Add Translation" OnClientClick="addTranslation();return false;" />

© 2015 Microsoft