I hope this blog post will be helpful for you to kick-start with Document Translation service in SAP Cloud Foundry.
Translates documents of up to 100MB in size or up to 1,000,000 characters (depending on the source language). The translation is returned to the user on completion.
Translates documents of up to 100MB in size or up to 2,500,000 characters (depending on the source language). The user can retrieve the translation at any time within three days after the translation was completed.
Now lets see the step by step procedure,
Step 1: In your CF subaccount, go to “Entilements” and click “Configure Entilements“.
Step 2: Click “Add Service Plans“.
Step 3: Search and select “Document Translation” and choose available plans “trial” and click “Add 1 Service Plan“.
Step 4: Click “Save” to save your entitlement.
Step 5: Once you save the entitlement. Go to space and select the space where you want to create service instance and service key for document translation.
Step 6: Inside your cf space, go to “Service Marketplace” and choose “Document Translation”.
Step 7: Create a new instance for document translation service.
Go to “Instances” and click “New Instance“.
Choose plan “trail” and hit “Next“.
Click “Next” in “Specify Parameter” and “Assign Application“.
Give your instance name and hit “Finish“.
Step 8: Once the service instance created successfully, you could see the created service instance as shown below. Click on the service instance name.
Step 9: Create Service Keys.
Go to “Service keys” and hit “Create Service Key”
Provide service key name and click “Save”
Step 10: You will see the below screen once your service key got created successfully. Copy documenttranslation.url, uaa. url , uaa.clientid and uaa.clientsecret which we will be using in our upcoming steps.
Step 11: Now lets get OAuth access token from postman or web browser.
Target Url: <uaa.url>/oauth/token
User Name: <uaa.clientid>
you could see the below response.
Yes we missed grant type in our target url, “grant type” refers to the way an application gets an access token. Since we are using Client ID and Client Secret to fetch access token, append “/?grant_type=client_credentials” to your target url. Now your target url looks like,
You will get the access token in your response. Copy it to use it in our next step.
Step 12: Paste the copied “<documenttranslation.url>” from step 10 in web browser to get the Swagger UI. Now click “Authorize“.
Step 13: Authorize Swagger UI by providing the OAuth access token which we fetched from web browser in Step 11. Give the value as “Bearer <accesstoken>” and hit “Authorize”.
Step 14:Once successfully authorized you will receive a message as authorized as highlighted below. Click “Close” to proceed.
Step 15: Click ‘document-translation”
Click “Try it out“.
Step 16: Choose the document you want to translate, enter the source and target language and hit “Execute“.
The document content before translation.
Step 17: On executing the api successfully you will receive the below response. Click “Download file” hyperlink. A file while get downloaded as shown below with the translated text.
The document content after translation.
That’s it you have successfully translated your document content.
In this blog post, We have learnt how to set up Document Translation service , how to fetch access token and use Swagger UI and translate documents in the language of your choice.
Suggestions are welcome