Monday, July 27, 2009

Resource Bundle - An Alternative Way to do localization in .Net

I posted another article on code project. Trying to copy and paste it over here was so much pain because the formatting of the source codes will totally mess up. So I will just post the link over here. I have been thinking about writing this article for a long time but hadn't found a good time earlier. Without that article, LocaleManger simply doesn't make sense to .Net developers because .Net resource files are not organized the way like Java or Flex. That article shows how localization can be done with a ResourceBundle class in .Net applications, with a walk through for both a WinForm application and a WPF application.


Friday, July 24, 2009

Using Microsoft Translate API in LocaleManager

Anyway, I needed to do some translation for an application I was working on. To make this task easier, I tried to plug in some codes to do machine translation with Google Translator. It turned out to be that Google doesn't like people to call their page from an application. After I got the translation from English to Chinese done, I continued to try to get Frech, German, Russian, Spanish, Japanese, and Korean, Arabic, etc. Then it stopped working.

I was getting 302 in service capture. Even when I went to browser to translate.google.com, I was redirected to some other page saying that Google suspect that there is some virus attack going on. It seems like Google only supports AJAX API for its translator, meaning that you can use it on webpages to let user to translate the page. But they don't want people to keep on request their page through an application. (That's interesting. I remeber when I was trying different load testing tools, I tried to use the tool to go to Google first to make a sample Load test.) I am not sure for how long Google block my IP. At least after the weekend, everything went back to normal.

Before I saw some news about Microsoft's Machine Translator and always wanted to try it. It turned out to be very simple to use. Here is a link to the Translate method on MSDN. An appID is required and here is the link to apply for an appID. I used the HTTP API in my application. For more details about other translator API, the Translator Hands on Lab is a good place to get information.

The Terms of Services for using the API are not very clear though. It seems like it is okay to use it in an application, however Microsoft reserves the right to start charging an app developer depending on the usage of their service. It is not clear like the Maps API's terms of services: Unlimited use. Use it in anyway you want.

But anyway, localManager now has the capabilities to do translation. It actually works pretty well. Human proof reading and editing is necessary of course with the machine translated text, but most of the translation is usable. At least it saves a lot of time and energy. From the Chinese translation I went through, I have to say that Microsoft Translator's overall quality is better than Google's. Microsoft's Translator can rearrage a phrase when needed pretty well. I was surprised with some translation they did for Chinese.

I want to take another look at the Terms and Services first and then I can push my new version of localeManager with translation capabilities.