Sunday, December 14, 2008

Localizing .NET applications

Most applications nowadays have to be localized in order to provide user interfaces in the language of the user who uses the application. The .NET framework offers a very handy mechanism to provide localization for your apps. It uses so called resource files (.resx) to store keys and the corresponding translated texts or images. If you want to know more on how to work with this translation mechanism take a look at this post.
The main problem with these files is to keep them in sync (for example when adding new strings) and to give translators an easy tool to make translation without requiring them to have visual studio installed on their computers.
I found a tool called "ResEx ... the composite, translation friendly .NET Resource editor" which can be found here that meets exactly this requriements. It provides a nice spreadsheet interface which makes it also for non programmers easy to translate the resources in the files. It is also possible to group resources together by using an underscore e.g. Menu_Home, Menu_Customers; they will all be shown under the tree node "Menu" which makes it easier to understand where the translations are used. Even adding and deleting localization languages is very easy.
The only thing which is missing is to have an automatic translation by using one of the several online translators available nowadays. I will suggest it on the forum and maybe this feature will be available in a future release.

Another very useful tool when working with resource files is the Resoucre Refactoring Tool on CodePlex. It helps you by localize strings in your source code by putting the string into the resource file and replacing the corresponding call in order to get a translated string.

1 comment:

Unknown said...

I have already a similar post in my drafts, which I started to write, but never finished. It deals about localizing custom-written Asp.net Ajax extenders. Maybe I'll finish it sooner or later, but time is rare :)
We're exactly using the mechanism you described with resource files etc.. for localizing our applications, since that's - you can imagine - a major request in our e-government applications. The automatic translation, by using online translation tools would be a nice idea for a tool to write :) One could give the tool the, say, German resource file and then let it translate into a given language. Maybe Google Translate has an API which could be exploited.
Another issue I often came over, and where I already often thought to write me a tool sooner or later, is to verify the resource-file for obsolete entries. I don't know whether it happened already to you, but it may be that you add some strings, then you continue your development, and features get removed from your app and so it may happen that there are still some resource messages left over, which are no more used. And so over time, you may get a lot of these strings left, which mess up your resource file.

I wish you and your girlfriend merry christmas :) Have some good days and enjoy the holidays :)