How To Use Microsoft Translator via a Console App
"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
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)
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)