Click here to Skip to main content
15,867,686 members
Articles / Desktop Programming / WPF

Auto Translate and Synchronize Resources in Your .NET Applications

Rate me:
Please Sign up or sign in to vote.
3.17/5 (9 votes)
14 Jun 2009CPOL4 min read 51.6K   56   18
Auto translate and synchronize is a little utility application and it works by simply taking your single fallback resource file (Resx) as input and automatically translates it in real time, creating a language specific resource file.

Introduction

Creating multilingual applications while being easy and improving greatly with each version of the .NET Framework, making the translations or replicating your fallback resource file across languages is a daunting task.

What happens is during the development of your application, you create key/value pairs in your .resx files, one at a time. This is not difficult, and VS.NET has a pretty good editor for resx files right there in VS.NET design environment itself. So far, so good.

It starts getting problematic later on when you now plan to create a resource for the 2nd, 3rd, 4th... language, you find yourself manually duplicating the resource file, renaming it and then editing the values to the new language.

That is the first problem, manual replication. The second problem is synchronization. Now that you have more than 1 resource file, e.g.: resources.resx, resources.en-US.resx, resources.it-IT.resx, etc. you are going to have to keep them in sync. So if you add a new key/value in your main resource file, you are now responsible to see that this key along with the language specific value is replicated across all your resources.

This is indeed a problem. AT&S is a little utility application written in WPF, and it's goal is to address both these concerns. This has been so much of an issue for me that as you can see, I ended up writing a utility application.

But yet again, I have a 3rd problem. The translation itself. I certainly do not have corporate backing and I do not have the monetary means to hire translators to make my application multilingual. Sure, I can do the Italian and English languages, but what about Japanese ? or Chinese ? Perhaps Hindi or Arabic ? mm maybe Russian ? This is a broader audience for me and yet I am unable to tap into that market.

The answer to all this is the recent online translator offered by both Microsoft and Google freely. This is fantastic because it may not be perfect, but I understand the translation perfectly and it makes sense. Not 100% but does it matter? It is better than nothing and it's free. Not to mention that if I really had the means, it would actually help reduce the task my translator will be doing now that half the job is done and the only remaining work is to make the necessary corrections to achieve a higher level of accuracy.

One issue I've had with the online translator is that I have key/value pairs, each value containing the data for the translation. And copying and pasting a value at a time via the online translators is not exactly how I want to spend my weekend and every weekend after that. In effect, both Microsoft and Google expose rich APIs to access their services which made it real easy to write a little utility application that interfaced with them and submitted the values for translation one value at a time in an automated manner. Perfect.

While this application is quite simple and consists of a single screen and 4 buttons, it's hard to not know what you need to do but let's simply walk through it.

Image 1

Before you can use either Microsoft translate or Google translate, you'll need to signup with them for an application ID (Microsoft) / API Key (Google) and supply this to the application. Note below we are supplying our Microsoft application Id.

Image 2

The Google API screen is identical.

After supplying the ID, you may very well select either Microsoft or Google as your translation service and begin. One thing to note is you also need to select your default resource file. All the translations and auto generated resources will be based on this.

Image 3

Also if you do not want translation but rather you simply want to duplicate the resource into a language specific resource file, then you may very well select the "System" option instead. When this is selected, instead of performing translation it will replicate the resource naming it accordingly with the selected language.

The resource files are auto generated within the same folder as your fallback resource, the one you browsed to previously (read above). If you want to view the newly created files in Visual Studio, you'll have to select the folder and from your Edit menu (main menu bar in VS.NET) or from Solution Explorer title bar itself, select the "Refresh" Icon. You also need to have "Show all files" option in Solution Explorer enabled by default, if not enable it.

Next you might also want to right click the file and select "Add to project" from within Solution Explorer, that way it's added to your project. In short, bottom line is any file you add from outside Visual studio requires this as it doesn't know.

Image 4

This application is available as a free download. You'll find it at http://www.jiffycms.net/autotranslatesynchronize.aspx.

There is no particular reason why the download requires a 30 second registration. I simply want to track usage and I want you as a member on my site :-) 

Just kidding. No signup required. Go grab it.

History

  • 14th June, 2009: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer Typps.com
Italy Italy
I'm alessandro and currently run www.typps.com

Comments and Discussions

 
QuestionA good alternative to this dead project Pin
ffonzz11-Apr-12 21:39
ffonzz11-Apr-12 21:39 
GeneralMy vote of 1 Pin
ffonzz11-Apr-12 21:33
ffonzz11-Apr-12 21:33 
GeneralMy vote of 1 Pin
fedias29-Aug-11 9:14
fedias29-Aug-11 9:14 
GeneralThe link provided doesn't work Pin
Member 798302022-Jun-11 2:32
Member 798302022-Jun-11 2:32 
QuestionDl Impossible Pin
Koektudis4-Mar-11 0:42
Koektudis4-Mar-11 0:42 
GeneralMy vote of 1 Pin
uswebpro218-Aug-09 15:32
uswebpro218-Aug-09 15:32 
GeneralGreat product - but needs an update Pin
uswebpro217-Aug-09 10:49
uswebpro217-Aug-09 10:49 
GeneralNo source code Pin
AndrusM15-Jun-09 22:30
AndrusM15-Jun-09 22:30 
GeneralRe: No source code Pin
Alessandro Zifiglio16-Jun-09 2:21
Alessandro Zifiglio16-Jun-09 2:21 
GeneralRe: No source code Pin
AndrusM16-Jun-09 3:19
AndrusM16-Jun-09 3:19 
GeneralRe: No source code Pin
Muditha Dissanayake2-Sep-09 23:52
Muditha Dissanayake2-Sep-09 23:52 
GeneralThis message appeared when I attempted to download your free application. Pin
robertjb2014-Jun-09 5:54
professionalrobertjb2014-Jun-09 5:54 
GeneralRe: This message appeared when I attempted to download your free application. Pin
Alessandro Zifiglio14-Jun-09 6:14
Alessandro Zifiglio14-Jun-09 6:14 
GeneralRe: This message appeared when I attempted to download your free application. Pin
Kubin26-Feb-12 21:56
Kubin26-Feb-12 21:56 
QuestionSimilar? Pin
Uwe Keim13-Jun-09 21:57
sitebuilderUwe Keim13-Jun-09 21:57 
AnswerRe: Similar? Pin
Alessandro Zifiglio14-Jun-09 5:07
Alessandro Zifiglio14-Jun-09 5:07 
GeneralRe: Similar? Pin
Uwe Keim14-Jun-09 5:18
sitebuilderUwe Keim14-Jun-09 5:18 
GeneralRe: Similar? Pin
Alessandro Zifiglio14-Jun-09 6:12
Alessandro Zifiglio14-Jun-09 6:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.