• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

  • Enterprise
    • Product
    • eBooks
    • Contact Us
  • Marketplace
    • Product
    • Sign Up
    • Docs
  • Resources
    • API Blog
    • API Tutorial
    • Developer Showcase
  • EnglishEnglish
    • 日本語日本語
You are here: Home / API Tutorial / Blend Language Features In Your App With Microsoft Text Translation API

Blend Language Features In Your App With Microsoft Text Translation API

November 8, 2019 By Shyam Purkayastha Leave a Comment

In a globalized economy, language translation becomes an important aspect of day to day business transactions with customers and partners from across the world. In the old world, you would have sought the services of a human translator while visiting a foreign country. However, now with the help of artificial intelligence, this job can be easily performed by machines.

Thanks to the power of the Microsoft Text Translation API, you can perform common language conversion tasks like translation, transliteration, and language detection with ease. In this blog post, we will show you how to leverage the Microsoft Text Translation API (v3.0) to build some compelling use cases around language text translation.

At Rakuten RapidAPI, we host thousands of APIs for helping developers build their apps rapidly. We are pleased to announce that the new version 3.0 of Microsoft Text Translation API is now fully integrated into our platform. So, log in to your Rakuten Rapid API account and head over to the API console.

API Tutorial Microsoft Text Translation

In case you don’t have an account on Rakuten Rapid API, sign up now and get your universal API key to access the Microsoft Text Translation API and thousands of other APIs hosted on Rakuten Rapid API.

Connect to API

Table of Contents

  • 1 Use Cases of Text Translation
    • 1.1 Language Translation
    • 1.2 Language Pronunciation
    • 1.3 Language Feature Detection
  • 2 Overview of the Microsoft Text Translation API
    • 2.1 1. GET Languages
    • 2.2 2. POST Translate
    • 2.3 3. POST Transliterate
    • 2.4 4. POST Detect
    • 2.5 5. POST BreakSentence
    • 2.6 6. POST Dictionary Examples
  • 3 Microsoft Text Translation API in Action
    • 3.1 Translating Language Text
    • 3.2 Transliterating Language Text
    • 3.3 Performing Utility Language Operations on Text
  • 4 Winding Up
    • 4.1 Share this:

Use Cases of Text Translation

Text translation has become a de-facto feature in all the virtual assistants and bot platforms that offer various types of services to users.

If you are building a similar platform and want to add translation features, then your requirement would fall under one of these top-level text translation use cases.

Language Translation

Text Translation

All of us have faced this situation. You read a label on a package arriving from a different country or struggling to find your way through the road signboards in a foreign country. Whatever may be the case, you feel an instant need to translate it into your native language.

The iTranslate app, available for the Apple app store is one of the popular language translation apps out there. It supports over 100 languages and also does voice translation.

Language Pronunciation

Transliteration

If you have been living in a foreign country for some time, then you would feel the urge to learn their language. By transliterating the foreign language text into your own language, you can take some baby steps and learn to pronounce simple words in that language.

Language Feature Detection

Feature Detection

If you are building a bot to interact with users, then you need certain language features to be detected to make sense of conversation. This is also a prerequisite for building NLP (Natural Language Translation) based services.

Let’s explore the Microsoft Text Translation API to realize these use cases.

Connect to API

Overview of the Microsoft Text Translation API

The Microsoft Text Translation API mainly supports translation and transliteration along with a few more endpoints for utility purposes. Take a look at the API Console.

Microsoft Text Translation API Console

Note: If you are searching for this API then make sure that you choose the Microsoft Text Translation V3.0 API and not the older deprecated API.

Here are the endpoints supported by this API.

Microsoft Text Translation Endpoints

1. GET Languages

This endpoint returns the languages supported by the API for translation, transliteration and dictionary operations.

2. POST Translate

This endpoint performs the translation of text from one language to another language. It can accept multiple sentences and is capable of detecting the input language.

3. POST Transliterate

This endpoint performs the script translation from one language to another. It also accepts multiple sentences, but the input language and script have to be explicitly mentioned as mandatory parameters.

4. POST Detect

As the name suggests, this endpoint can be used to detect the language of the input text passed to it.

5. POST BreakSentence

Sometimes there is a need to break a long string of text into its constituent sentences. This endpoint can do that.

6. POST Dictionary Examples

This endpoint can look up a dictionary and dig out usage examples and phrases for a word and display them in a target language.

The Microsoft Text Translation API is available under a freemium pricing model. You can subscribe to the basic plan at zero cost and get 2500 API calls per month.

Microsoft Text Translation Pricing

Connect to API

Microsoft Text Translation API in Action

Now for some translation fun. But before you test the Microsoft Text Translation API, it’s worthwhile to call the “Languages” endpoint to get the capabilities of the API. Here is a snippet from the API response.

Microsoft Text Translation Languages Response

Expanding it further will list the supported languages for specific operations. For instance, expanding the “translation” key will list all the languages that the API can translate to and from.

Microsoft Text Translation Languages Response Translations

Similarly, expanding the “transliteration” key will list all the languages and their scripts along with the scripts to which they can be converted to.

Microsoft Text Translation Languages Response Transliteration

This information is helpful while passing parameters for the API. Here’s how you can make use of Microsoft Text Translation API endpoints to build translation features in your app.

 

Translating Language Text

Fire up the API console, and select the “Translate” endpoint to pop in the required parameters as shown.

Microsoft Text Translation Translate

The ‘to’ refers to the language that you want to translate to and the value ‘hi’ is the shortcode for Hindi. The ‘Text’ contains the JSON array containing the sentence to be translated, as shown.

Hit the “Test Endpoint” button and you should get the translated text in the Hindi language.

Microsoft Text Translation Translate Response

You can try this endpoint by keying in the language of your choice. Check out the supported language shortcodes listed under the “translation” key in the response of the “Language” endpoint.

 

Transliterating Language Text

Transliteration also means to translate literally. By transliterating a text in a foreign language, you can spell it in your language. This way, you can pronounce it in the way it is done in a foreign language.

Select the “Transliterate” endpoint and enter the same text in Hindi that we tried translating to.

Microsoft Text Translation Transliterate

In this case, you have to also choose the ‘fromscript’ which is deva, meaning Devanagari script, and “toScript”which is latn meaning Latin script. The API response is

Microsoft Text Translation Transliterate Response

In this way, you have transliterated a sentence in Hindi to English so that you can pronounce it exactly the way it is supposed to be done in Hindi.

Check out the supported language shortcodes listed under the “transliteration” key in the response of the “Language” endpoint to try out more languages and scripts.

 

Performing Utility Language Operations on Text

When you are building a bot platform to interact with users through a chatbot interface then, there are several trivial challenges. For example, before the bot can even process the text, it needs to detect the language and split the text into reasonable chunks.

Microsoft Text Translation API offers a utility API endpoint “BreakSentence” which can detect the language of the input text as well as provide information about the sentences.

Select the “BreakSentence” endpoint and test it.

Microsoft Text Translation BreakSentence

You will see the API response.

Microsoft Text Translation BreakSentence Response

 

The first highlighted portion indicates the detected language, which is English in this case.

The second highlighted portion lists the length value of each sentence detected in the text entered in ‘Break Sentence’ parameter during API call. The API response reports three sentences in the text, each with a length of 13, 11 and 22 characters.

With this information, your bot can process the split the input text into its constituent sentences and process them sequentially. This is also a very handy tool when processing bulk input text for analysis purposes.

Connect to API

Winding Up

Apart from bots and the usual text analysis apps, this API also finds application in social media analysis which is a huge source of textual and conversational data from all across the world.

You must check out our Top 10 Translation APIs to know more about similar APIs hosted in Rakuten RapidAPI. You can also check out our translation API collection and see if it suffices your requirements for text translation and related operations. Finally, don’t forget to check the tutorial on Google Translate API.

Tran

Signing off now, until we are back in a few days with another API tutorial.

5 / 5 ( 1 vote )

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Reddit (Opens in new window)

Filed Under: API Tutorial Tagged With: Microsoft Text Translation

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Accelerate tech modernization

To compete in the digital age, Rakuten RapidAPI helps enterprises deploy scalable and flexible IT systems to allow for ongoing experimentation and iteration at speed.

Learn More
Try Rakuten RapidAPI for free
  • Enterprise
  • Marketplace
  • Resources
  • EnglishEnglish

© 2021 Rakuten RapidAPI. All rights reserved.