Skip to Content

Have you enabled SAP Translation Hub on the trial landscape of SAP HANA Cloud Platform (HCP), but you’re looking for more detailed, visual guidance on how to test the service? Check out our how-to video:

 

 

If you don’t have an account on the HCP yet, visit https://account.hanatrial.ondemand.com/ to get started today!

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Gregor Wei├čenborn

    With this video I had no problem to use this with the Advanced Rest Client.
    But if I try that with a javascript this fails with an error message.

    Here is my code (personal information like password and username is changed of course):

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>

    <html>

      <head>

      <meta http-equiv=”content-type” content=”text/html; charset=windows-1250″>

      <title></title>

      <script type=”text/javascript” src=”./jQuery.js”></script>

      <script type=”text/javascript”>

     

      function SendRequest (dta){

        var out;

        $.ajax({

              url: ‘https://saptranslation-myaccountnumbertrial.hanatrial.ondemand.com/translationhub/api/v1/translate‘,

              async: false,

              data: dta,

              type: ‘post’,

              contentType: ‘application/json’,

              dataType: ‘json’,

              beforeSend: function (xhr) {

                  xhr.setRequestHeader(‘Authorization’, make_base_auth(‘myaccountnumber’, ‘mypassword’));

              },         

              success: function(output){                  

                         out=output;

                       },

              error: function(xhr, status, error ){

                       alert(status + “: ” + error);

                     }                   

        });

        return out;

      } 

     

      function make_base_auth(user, password) {

          var tok = user + ‘:’ + password;

          var hash = btoa(tok);

          return ‘Basic ‘ + hash;

      } 

     

      $(document).ready(function(){

        var obj = {};

        obj.targetLanguages = [“en”, “de”, “fr”, “bg”, “ru”, “ja”];

        obj.bundles = [{“domain” : “B2”, “units”:[{“textType” : “XFLD”, “key” : “LOGIN_USERNAME_FIELD”, “value” : “User Name”, “searchData” : {“language” : “de”, “value” : “Benutzername”}}]}];

       

        alert(SendRequest(JSON.stringify(obj)));

      }); 

     

     

      </script>

      </head>

      <body>

      </body>

    </html>

    Error.png

    What do I wrong?

    (0) 
    1. Ian Armstrong Post author

      Hi Gregor,

      I’m glad the video helped you to consume the service in the Advanced Rest Client! The problem you’re facing is due to browser restrictions related to the same-origin policy. For further details on your specific use case and a possible solution, please contact us at translationhub@sap.com

      Best,

      Ian

      (0) 
  2. Jennifer Stanley

    Thank you very much for doing this video blog.  I like this tool.  One question I have though, is whether I need a separate password for the GIT repository when requesting translations from the SAP Translation Hub.  I get this error when I attempt to get the translations for my App./wp-content/uploads/2016/05/password_962290.gif

    /wp-content/uploads/2016/05/problem_962291.gif

    (0) 

Leave a Reply