Skip to Content
Author's profile photo Ian Armstrong

SAP Translation Hub on the HCP: How-To Video

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!

Assigned tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      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?

      Author's profile photo Ian Armstrong
      Ian Armstrong
      Blog 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

      Author's profile photo Former Member
      Former Member

      Hi Ian,

      thank you very much for the answer which was helpful for me.
      I wasn't aware about the "same-origin policy" and searched that in wikipedia:
      https://en.wikipedia.org/wiki/Same-origin_policy

      I will try my usecase from an own non-browser based application.

      Thank you!

      Brg
      Gregor

      Author's profile photo Jennifer Stanley
      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

      Author's profile photo Beatrice Pasch
      Beatrice Pasch

      Hi Jennifer, I'm not aware of a different git password.
      Could you please have a look to our FAQ list: SAP Translation Hub - FAQ - I hope that the answer for question 2 is helpful. If not please send us an email to translationhub@sap.com.

      Kind regards, Bea

      Author's profile photo Christian Happel
      Christian Happel

      AFAIK the Git repository doesn't integrate with Cloud Identity yet. You will have to use your SCN user for that, and not a P-number.