First time here?

You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting!

A while back immediately after MIX10 I started messing with Microsoft Translator APIs for Silverlight applications.  I also got some people asking about Windows Phone 7 stuff and messed around with that a bit.  Here’s some post for reference:

In talking with the Translator team following MIX (where they announced they were working on a Silverlight class library for the API.  It was good to interact with their team to understand their direction and provide some feedback on how they were approaching it.  In the meantime, with their direction, I had started working on a simple wrapper for myself while writing the Translator for Seesmic plugin I was writing.  I’ve received a few inquiries on Translator so I thought I’d post my library here for you to see/use.

NOTE: This comes with a ‘works on my machine’ warranty – which means no warranty.  There are some things that should be done to make this a more proper async API (noted below).  You will also need your own Microsoft Translator application ID (API key) in order to use it.

The API is fairly simple and maps to some of the functions of the Translator HTTP-based API.  The following methods are implemented:

  • Detect
  • GetLanguagesForSpeak
  • GetLanguagesForTranslate
  • Speak
  • Translate

You’ll notice that not all the API endpoints are implemented.  Honestly I picked what I was using myself but also what I think would be most useful to application developers. 

Because this is a service, the wrapper implements the above functions as asynchronous methods, so you will see:

  • DetectAsync
  • GetLanguagesForSpeakAsync
  • GetLanguagesForTranslateAsync
  • SpeakAsync
  • TranslateAsync

Clever naming, huh?  It’s very simple to use and here’s a snippet of a BASIC translation implementation:

   1: using System;
   2: using System.Windows;
   3: using System.Windows.Controls;
   4: using TimHeuer.Silverlight;
   6: namespace SilverlightApplication147
   7: {
   8:     public partial class MainPage : UserControl
   9:     {
  10:         TranslatorClient _translator;
  12:         public MainPage()
  13:         {
  14:             InitializeComponent();
  16:             _translator = new TranslatorClient("YOUR_APP_ID");
  17:             _translator.TranslateCompleted += new EventHandler<TranslateCompletedEventArgs>(OnTranslateCompleted);
  18:         }
  20:         void OnTranslateCompleted(object sender, TranslateCompletedEventArgs e)
  21:         {
  22:             Dispatcher.BeginInvoke(() =>
  23:                 {
  24:                     MessageBox.Show(e.TranslatedText);
  25:                 });
  26:         }
  28:         private void TranslateButton_Click(object sender, RoutedEventArgs e)
  29:         {
  30:             // if you needed to detect the source language first you would run DetectAsync to get the Source Language
  31:             // below is an example of TranslateAsync("Du bist wie eine Blume", "de", "en")
  32:             _translator.TranslateAsync(TextToTranslateTextBox.Text, SourceLanguageTextBox.Text, TargetLanguageTextBox.Text);
  33:         }
  34:     }
  35: }

So that’s it.  What are the plans here?  We have been exploring shipping an official translator extension as a part of the Silverlight Toolkit perhaps if folks find it useful.  As I mentioned there are a few things that should probably be changed in this library here, namely making the event arguments be AsyncEventArgs to better match what they are with the Silverlight networking stacks, etc.

I also was messing around with the InstallShield Limited Edition that comes with Visual Studio 2010 so I wrapped all these into an installer for easier deployment (it also includes the source) that you can get here: TimHeuerTranslatorClientSetup.exe

Hope this helps and let me know if you have feedback!

This work is licensed under a Creative Commons Attribution By license.

6/4/2010 2:59 AM | # re: Microsoft Translator client library for Silverlight
It would be nice to have a translator extension.
Would it be possible to have speech recognition in Silverlight (e.g by using the Speech API using COM automation?)
Speak to an app and than see the result in a textbox?
6/23/2010 12:07 PM | # re: Microsoft Translator client library for Silverlight
Thanks alot, I'll be looking at this.

It could be that I don't understand something but I had two problems installing:
1) It was saved as "TimHeuerTranslatorClientSetup" and I had to rename it to "TimHeuerTranslatorClientSetup.exe" to get it to run.

2) During installation it allowed me to select a different folder but it did not use the folder that I entered instead it put it in "Tim Heuer\Translator Client for Silverlight"

But, I got some source to look at so thank again.
7/26/2010 9:34 AM | # re: Microsoft Translator client library for Silverlight
It seems, the exe file is not available there any more. could you please give access to the code. It seems to be really very useful. Thanks
9/7/2010 6:54 AM | # re: Microsoft Translator client library for Silverlight
I don't think this is available anymore. Can you please post it again? I would like to use it in a WP7 project and I need to rebuild it as a Silverlight 3 assembly.

Thank you
2/4/2011 6:11 AM | # re: Microsoft Translator client library for Silverlight
Thanks bit by bit I am getting better at doing this coding stuff. But of course I still lack a few things. making money
2/20/2011 4:36 PM | # re: Microsoft Translator client library for Silverlight
Nice post. I learn something more challenging on different blogs everyday. It will always be stimulating to read content from other writers and practice a little something from their store. I’d prefer Bluetooth Musik Empfänger to use some with the content on my blog whether you don’t mind. Natually I’ll give you a link on your web blog. Thanks for sharing.
7/8/2011 11:14 PM | # re: Microsoft Translator client library for Silverlight
Thank you so much. I learned 30 new things about illustrator from this one video. I would also like to add that the video is great since I can skip forward and backwards with the <-- and --> keys. Simple, clear narration are awesome.Trucking Software
7/14/2011 12:17 AM | # re: Microsoft Translator client library for Silverlight
It is important to choose right one since the first time. Thank you for the tips. Proper care will save money in long term.Tarife vergleichen
8/4/2011 5:41 AM | # re: Microsoft Translator client library for Silverlight
This site always help me ..All post are very nice over here.
gas station pos software
8/19/2011 2:34 AM | # re: Microsoft Translator client library for Silverlight
Hey Tim, thanks for your contributions to Silverlight, especially this highly useful translator client library. Keep up the awesome work.
Richard - pitney bowes ink
8/22/2011 3:03 PM | # re: Microsoft Translator client library for Silverlight
I'm curious is the translator client library now included with Silverlight 5?
broadband telephone engineer
9/27/2011 1:28 PM | # re: Microsoft Translator client library for Silverlight
The translator extension of this looks great. I've been thinking of something similar for a while now and I'm glad you have put it together. If I had better skills when it comes to coding I would have done something like this. Silverlight is great. Pittsburgh Chiropractor
11/19/2012 4:12 AM | # good seo for casino game
This is best site to spent time on .I just stumbled upon your chatty blog and wanted to say that I have really enjoyed reading your very well written blog posts.

Please add 1 and 8 and type the answer here:


The opinions/content expressed on this blog are provided "ASIS" with no warranties and are my own personal opinions/content (unless otherwise noted) and do not represent my employer's view in any way.