.NET Zone is brought to you in partnership with:

I’ve been a Windows developer since 3.0 and caught the Visual Basic wave early with v1. I’ve released a “production” application in every version of VB since then (except VB for DOS). Focusing on enterprise, line-of-business development I’ve built Call Center Applications, Mortgage finance systems, Customer Relationship Management tools and more recently I’ve been in the Litigation Support/Electronic Data Discovery/Electronically Stored Information space. Greg is a DZone MVB and is not an employee of DZone and has posted 477 posts at DZone. You can read more from them at their website. View Full User Profile

How To Use Microsoft Translator via a Console App

  • submit to reddit

Visual Studio Gallery - Walkthrough: Microsoft Translator in a C# Console Application

"This sample explains how to use the Microsoft Translator API through the Windows Azure Marketplace by creating a sample application which takes an input string and translates it from the detected source language to a random output language.


Having seen some of the cool projects people have been doing with the Microsoft Translator API I decided to write a small app and learn how the APIs work. Since this is a learning exercise, I wanted something that’s very simple and yet powerful enough to exercise all of the key features in the API. The Console application I came up with takes a string as a command-line argument. It firsts asks the service what language the string was written in. Next, it asks for the list of all supported languages and chooses one at random. Finally, it gets the string translated from the source language to the randomly selected target language. You put a string in and get a random translation of that string out. The design is simple, so let’s look at the implementation!

1. Getting Ready to Code

2. Preparing the Development Environment

3. Determine the Language of the Input String

4. Get a List of All Supported Languages

5. Translate the String to the Randomly Selected Languages

6. Result



I thought this a great walkthrough for using the Microsoft Translator service, where being in a console app lets you focus on the lesson at hand (and not the plumbing)

Published at DZone with permission of Greg Duncan, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)