Automatically Translating resx Files Using Microsoft Translator

Back in April 2009 I wrote about the Microsoft Translator (aka the Bing Translator), the various APIs that it exposes and in particular the REST API that it exposes to allow the automation of translation. At the time I also added a Microsoft Translator class to the list of translator classes used in the tool suite for my book, .NET Internationalization. In this post I join the dots and show you how to make use of these classes and automatically translate your resx files to another language.

  1. Get your Microsoft Translator "app id" from http://search.live.com/developers/appids.aspx.
  2. Download the free source code for the book from here.
  3. Extract the source code to a folder of your choice.
  4. Open ResourceAdministration\ResAdmin\App.Config and change the "value" of the "MicrosoftTranslatorApplicationId" key to the "app id" that you were given for the Microsoft Translator.
  5. Build the source code by opening a Visual Studio command prompt in the folder that you extracted the source code to and running "msbuild BuildAll.proj". If FxCop is not installed on your machine there will be build errors but these are not related to the translation tools and you can ignore these.
  6. Connect to the internet (the Microsoft Translator needs an internet connection).
  7. In ResourceAdministration\ResAdmin\bin\debug you will find ResAdmin.exe. This is the Resource Administrator which is a developer tool for managing resources. Run ResAdmin.exe.
  8. You will see the following dialog. In the "Source of Resources" enter the base directory containing your resx files. In the "Invariant language" enter the language code that the original resources are in (e.g. "en" for "English"). Click OK. ResAdmin Resources Source
  9. Next you will see the main form. You need to tell the Resource Administrator what language(s) to translate to. Select Tools | Languages and enter all of the languages to translate to (you should probably de-select Albanian at this point). Click OK. ResAdminMainForm
  10. You will be asked if you want to automatically add the necessary resx files for the new language(s).ResAdminAddLanguages Click Yes. At this point if "Automatic Translation" is on (see the status bar) the text in the resx files will be translated.
  11. The Resource Administrator tool uses a collection of machine translators to translate text where it falls back to other suitable translators if one fails. You can configure which translators are included in the list by selecting Tools | Translators.

Note that the Resource Administrator utility is not hard wired to use solely resx files. You can use the same utility with other sources of resources (including a database) by selecting Tools | Resources Source.

For more information on how to use the Resource Administrator see the .NET Internationalization book.

Currently rated 3.8 by 4 people

  • Currently 3.75/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: guysmithferrier
Posted on: Tuesday, September 29, 2009 at 6:14 PM
Tags:
Categories: Internationalization | .NET Internationalization Book
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

Related posts

Comments

Chad Nash us

Wednesday, December 23, 2009 7:54 PM

Chad Nash

Hi guys... I created a much faster way to <a href='http://www.RESXTranslate.com'>translate RESX files </a> and its a free online tool at www.resxtranslate.com. Basically you can just upload a zip file of your localization and RESX files and it will translate them into any selected language. You will receive an email of the report and a new zip file with the updated localization files in it. Its that easy!

-Chad