L10N: Maintainable Resex Files

When you plan to make your project multi-language and you are nearing its completion it is not smart to put those resource strings on a .resex files and edit right from your IDE. Why? Simply because it is not maintainable and hard to track changes whenever you add new entries. Also, your translators don't know anything about Visual Studio and of course you won't require them to install it. They even can't read XML files.

For new on resex, resex as I called it is the raw resource file for .NET web and windows applications. It used to  store strings and images that is so smart it can automatically transform your application into a multi-language product with very little effort, just some filename tweaks. These resex files when compiled turned into .resources file placed on specific folder named after the cultures used. A resex file is nothing but an XML file.

If you create a resex file Admin.Messages.sv-SE.resex (swedish-sweden) and Admin.Messages.nn-NO.resex (norweigian-norway), when the project was compiled it will create folders sv-SE and nn-NO on your output folder.  

While your are on development and using VS2005 IDE, string resources are automatically sorted whenever you close the editor and open it again. If you have 1,000 string entries A-Z and you added new strings in e.g. ErrorInvalidPath and ErrorTransactionDeclinedDueToExpiredCard and you closed the editor, then you have to scroll again and search for those entries in cases you need to change it. Inconsistencies on naming resource IDs may arise as entries gets bigger. 

That said,  it is better if you just create an excel file for those entries. Named the file after the assembly name, in my case I have Admin.Messages.xls, Admin.Labels.xls, Admin.Mails.xls that corresponds to Admin.Messages.resex, Admin.Labels.resex and Admin.Mails.resex respectively.  Inside are multiple sheets named after the culture and with values in reference into master entries. On each template I have sheets en-US, da-DK, nn-NO, sv-SE etc. Whoever you want to add new entries, you need to add it on the master sheet. Open the specific sheet and copy all entries. Open the resex file on your IDE, delete all entries and paste rows you copied from Excel. May sound complicated? download the template here.

To track versions of these files, I advised that you create an "artifacts" folder on your source controls trunk.

Btw I'm working now in porting Xeno, a tool created by punzie of PHINUG, that read these excel files to generate the resex files. It works on VS2003 but I have some issues using it on VS2005. More on my L10 experience. Stay tuned.