C# Window forms Translate using BING API


C# Winfroms Translate using BING Translation API

While working in one of my projects, i wanted to use translation service which will translate some  sentences for me. Google's translation services are one of the best translation services which were free. Unfortunately, Google stopped providing its translation API for free & now they don't offer translation api for free. That was biggest disappointment for me but i had to find some other translation services.Microsoft Bing Translation api was another alternative i had.

How to use BING translation API in c#
I came across very nice post by Jimmy Collins blog. I would recommend you  download his source code which is at the end of article.

Create your Bing Application ID

First, You will need to create a valid bing application ID for your application. This is essential in order to be able to call the web service. Go to to Bing’s Developer Centre and sign in with your Windows Live/ hotmail ID. You will have to follow few steps to create your application ID & then you are ready to use the service.

Next step is to create Visual studio project.
1. Create new window Application
2. Go to solution explorer & right click on solution & 'Add service reference'.
3. Paste 'http://api.microsofttranslator.com/V1/SOAP.svc' in textbox & give an appropriate name to the service & press 'Go'.
4. I am going to name it as BingTranslatorService
5. You should be able to see the service added under Service References.
6. Now use following code to get your text translated.

          try
            {
                BingTranslatorService.LanguageServiceClient client = new BingTranslatorService.LanguageServiceClient();
                client = new BingTranslatorService.LanguageServiceClient();
                targetTextTB.Text = client.Translate("PUT YOU APP ID HERE", "Hello World", "en", "cs");
            }
         catch (Exception ex)
            {
                MessageBox.Show("An error has occurred: " + ex.ToString(), "Error");
            }

7.  "en" stands for English language & "cs" stands for Czech.
8.  You can put any language of your choice & for that you need to just change the variables from "en" any language you want.
9. You can download the source code Here.

C# Winfroms Translate using BING Translation API

While working in one of my projects, i wanted to use translation service which will translate some  sentences for me. Google's translation services are one of the best translation services which were free. Unfortunately, Google stopped providing its translation API for free & now they don't offer translation api for free. That was biggest disappointment for me but i had to find some other translation services.Microsoft Bing Translation api was another alternative i had.

How to use BING translation API in c#
I came across very nice post by Jimmy Collins blog. I would recommend you  download his source code which is at the end of article.

Create your Bing Application ID

First, You will need to create a valid bing application ID for your application. This is essential in order to be able to call the web service. Go to to Bing’s Developer Centre and sign in with your Windows Live/ hotmail ID. You will have to follow few steps to create your application ID & then you are ready to use the service.

Next step is to create Visual studio project.
1. Create new window Application
2. Go to solution explorer & right click on solution & 'Add service reference'.
3. Paste 'http://api.microsofttranslator.com/V1/SOAP.svc' in textbox & give an appropriate name to the service & press 'Go'.
4. I am going to name it as BingTranslatorService
5. You should be able to see the service added under Service References.
6. Now use following code to get your text translated.

          try
            {
                BingTranslatorService.LanguageServiceClient client = new BingTranslatorService.LanguageServiceClient();
                client = new BingTranslatorService.LanguageServiceClient();
                targetTextTB.Text = client.Translate("PUT YOU APP ID HERE", "Hello World", "en", "cs");
            }
         catch (Exception ex)
            {
                MessageBox.Show("An error has occurred: " + ex.ToString(), "Error");
            }

7.  "en" stands for English language & "cs" stands for Czech.
8.  You can put any language of your choice & for that you need to just change the variables from "en" any language you want.
9. You can download the source code Here.

Was that useful? Why not share it?

By: