ASP.NET MVC

How To Convert English Word (Source Language) To Other Language (Target Language) Using Google Translate API

Introduction

In this article, we will learn how to convert English words (Source Language) to other language (Target Language) using Google Translate API.

Let’s begin

Google Translate API

   https://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=ur&dt=t&q={keys}

sl – Source Language Code Like en, hi, ur etc.

tl –  Target Language Code Like en, hi, ur etc.

{keys} – your word

Different Language Code

Hindi – hi

Gujarati – gu

English – en

Marathi – mr

More Languages Code Here.

Google Translate API Using POSTMAN

Google Translate API Using Jquery

Below code add in your jquery file and get word to your target language.

function SourceLanguageToTargetLanguage() {
     var sourceLanguage = "en";
     var targetLanguage = "hi";
     var word="Your Word";
     var googleTranslateURL = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" + sourceLanguage + "&tl=" + targetLanguage + "&dt=t&q=" + word;
            var requestOptions = {
                method: 'GET',
                redirect: 'follow'
            };
            fetch(googleTranslateURL)
                .then(res => res.json())
                .then(res => {
                    if (res && res[0] && res[0][0] && res[0][0][0]) {
                        name = res[0][0][0];
                    }
       });
}

Output :

If you have any questions or issues about this article, please let me know.

Sagar Rana

Sagar Rana is a Web Developer in Vision Infotech. He has strong skills and knowledge of ASP.NET C#, ASP.NET MVC, .Net Core, Jquery, JavaScript, WEB API, React.js, ADO.Net, Entity Framework, SQL and different integration like Xero, Stripe, Zoho CRM, Square, PayTM, PayKUN, RazorPay, Quickbook Desktop etc.

Recent Posts

Testing hk

Testing

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

Operation

Testing

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

TETS NEW

test

3 years ago