Introduction

This is my first article so bear with me :) I want to share this with you because I think ResxWriter has some very nice functionality and some cool features. A break down:

Generates .resx files using ADO.NET and an Excel spreadsheet.

Fully customizable.

Settings are per machine user.

Clean uninstallation, with launcher.

ResxWriter is a .NET tool that can read Excel spreadsheets with data used for translation, and convert this data into separate .resx files.

Recently, I was working on an ASP.NET application that needed to have full translation for all static text. We used .NET resource files (.resx) and things were moving along just fine. Updating the text, however, was another story. Using Visual Studio to manually update the .resx files was cumbersome to say the least. Formatting was a pain if you used the IDE, although formatting the XML was an option…

Instead I decided to write an app that would take data from an Excel spreadsheet and generate the .resx files. This allowed our translation staff to use a program they are familiar with, as well as share the files for others to work on.

Reading the Excel File

Suppose you had the following data in a spreadsheet:

ControlName

English

French

BtnHello

Hello World!

Bonjour Monde!

LblHello

Hello World Again!

Bonjour Monde encore!

ResxWriter can extract the data from each column and create .resx files. Any number of columns can be used, and the application can be fully customized.

All settings in this app are specific to the current user, saved at /Documents and Settings/{User name}/Application Data/... This conforms closely to Microsoft's recommendations, and lets each user have their own experience and preferences.

I hate it when an application uninstalls but doesn't remove all files it was using. So, I made an app that cleans up for a true uninstallation. It essentially deletes all directories and files in its current location. Also, the only method (through Visual Studio) to create an uninstallation icon was to create a Uninstallation Launcher. In the source code, the launcher finds the product key used by the MSI file. This triggers the repair or remove screen, and allows uninstallation.

(These are both included as separate projects in the Solution file.)

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

After generating the first resx, the next time we press "Generate .resx Files" it writes the keys and values from the previous generation and then the new keys and values.In other words, it maintains all the previous keys and values for subsequent generations.

that way the writer does not generate empty resource entries, but skips them. In my case: column one is neutral and filled all out, column two is localized, but is left empty when a string should be used from neutral column.

of course the "real" correct behaviour should be to determine, if there is a language invariant column and treat this column right. but, time is limited and this works for me...

I am currently developing an application for the market that will need globalising, and I shall certainly give your app a go. What we really need to start with, however, is a tool to do the opposite - to take our English resx files and convert them to a spreadsheet that we can then present to the translators. Anyone have any suggestions?

great stuff, this is going to save me plenty of time If you're still thinking of adding functionality, I would have allowed the user to control the number of output files (I'm working with 14 languages... )

Brilliant App. Love it. However, I am struggling a little with an oddity in the resx file generation. Large text content in a single Excel cell seems to be getting truncated in the conversion to resx. I intially thought it might be that commas in the text were affecting it somehow but after testing and seeing truncation in our japanese resx file as well I am stumped. The following text content, destined for a label control truncates at 'comprehensiv' before the 'e':

---

Welcome to AAAAAAAA AAAAAAA AAAAAAAA. This powerful tool will help you gain clear insights into your customer accounts, so that you can meet their needs more accurately and increase your advantage over the competition.The analysis process is comprehensive, easy to use, and flexible. Include only as much information as you would like for each account. At the end, you will be able to review a checklist and print a complete report.To start, click the following buttons in sequence and fill in the requested information.

OK - so this isn't the most well researched answer. But googling on ADO Excel data truncation turned up this: http://support.microsoft.com/kb/189897/EN-US/ . Although this refers to Excel 97 ODBC - sure enough when I moved one of the cells containing over 255 chars to the top of the document, all large cell content was corrected after export into resx. This is more of a Microsoft 'feature' than a bug - the driver appears to determine cell size from the first n rows and apply that to all.

What it does mean is that either your largest cell content should be listed as the first row in the resource spreadsheet or maybe that some kind of parameter/config is needed when handling ADO?

Has you found any solution? I have to store the body email text in html in an excel to be translated in diferent languages and generate the resources with this tool, but I cannot do it with this problem. Thanks.

As stated in Brady's post however, it would be really useful to have a facility for importing existing resx files into Excel, where they could then be modified/finished off before exporting back to native resx format.

thanks for your comments, cliff. one of the reasons i didn't even attempt this was because in the original excel files we were using, there were many extraneous columns, and since i wasnt interested in this data (from the .resx perspective), i knew i wouldnt be able to recreate the same spreadsheet in this manner.

as far as simply collecting a group of .resx files and merging their content into a spreadsheet- sounds fun! i appreciate the idea, and will definitely look into implementing this (as time permits )

thanks again for the feedback and suggestion!

//--------------------------//The following sentence is true.The previous sentence is false.